A service in cloud computing is executed in a data center, which may result in large communication delay. To host applications requiring low latency, edge/fog computing has attracted great attention. This paper proposes a mechanism called AFC (Application Function Chaining) for realizing distributed edge/fog computing. In AFC, an application is defined as a Chained-AF, which is composed of one or more AFs (Application Functions) with control structures such as conditional branches. An AF basically fulfills a single task similar to a UNIX command. Thus, a Chained-AF looks like a distributed shell script and the networks look like a single computer from users' viewpoint. A MANO (Management and Network Orchestration) mechanism in AFC places AFs on optimal edge/fog servers which satisfy Chained-AF's requirements when it is launched. Evaluation results of a prototype implementation show that it takes 0.5 seconds and 3 seconds to launch a Chained-AF composed of two and six AFs, respectively, and that the throughput of a Chained-AF is more than 90 % of the line speed, which is independent of the number of AFs. The throughput of an AFC depends on processing performance of AFs, not on the AFC mechanism.