Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sequencing combinator (not S-combinator)

See original GitHub issue

The seq combinator is used to loop over a sequence of functions. It takes two or more functions as parameters and returns a new function, which runs all of them in sequence against the same value. This is the implementation:

const seq = function(/*funcs*/) {
    const funcs =;
    return function (val) {
       funcs.forEach(function (fn) {

With it, you can perform a sequence of related, yet independent, operations. For instance, after finding the student object, you can use seq to both render it on the HTML page and log it to the console. All functions will run in that order against the same student object:

const showStudent = R.compose(

The seq combinator doesn’t return a value; it just performs a set of actions one after the other. If you want to inject it into the middle of a composition, you can use R.tap to bridge the function with the rest.

From page 114 of Functional Programming in JavaScript

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

char0ncommented, Dec 21, 2017

Ok as far as I understand, Luis Atencios explanation is incorrect ? It seems like that this is the case. S-combinator works a bit different than Luis implemented it. Or in different words: he implements only subset of what S-combinator should be ? Anyway I would like to invite Luis to participate in this debate so that we get it right. And it also seems that we already have an S-combinator in ramda implemented as ap:

R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA'

This works exactly as you described the S-combinator.

char0ncommented, Dec 22, 2017

Ok nice research. So there are two combinators, S-combinator and Sequencing combinator. I see them as two completely different things. Let’s implement the sequencing combinator here and heal with the rest in #250

Read more comments on GitHub >

github_iconTop Results From Across the Web

Normal order sequencing combinator - why does it work?
It warns that "z should not be free in y" but that makes no sense. y is a bound variable. The only way...
Read more >
Next-sibling combinator should not work with complex selectors
It always begins with a type selector or a universal selector. No other type selector or universal selector is allowed in the sequence....
Read more >
Combinators - Learn web development | MDN
If you want to select siblings of an element even if they are not directly adjacent, then you can use the general sibling...
Read more >
Combinators and the Story of Computation
A historical look at the development of combinators within the field of mathematics, their importance in developing modern computation, ...
Read more >
The combinator would not work in applicative order (call by ... The applicative-order sequencing combinator can be written as follows:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found