Skip to main content
added 21 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 15 bytes

ċƇf/>Ƈ⁹ȧ
çⱮFḟ@Ɱ

A monadic Link accepting a list of lists of strictly positive integers that yields a list of lists of strictly positive integers.

Try it online! (The footer calls the Link for each and formats the output)

How?

ċƇf/>Ƈ⁹ȧ - Helper Link: list of lists, A; integer, I
 Ƈ       - filter keep those lists in A for which:
ċ        -   count occurrences of I - truthy if the list contains I
   /     - reduce this list of lists that contain I by:
  f      -   filter keep
             - i.e.gets us a list of those values appearing in all of them
      ⁹  - use I as the right argument of:
     Ƈ   -   filter keep those integers that appeared in all for which:
    >    -     greater than I?
       ȧ - logical AND I (non-vectorising)
             - i.e. I if it is a consistently dependent smallesmaller integer, else 0

çⱮFḟ@Ɱ - Link: list of lists, A
  F    - flatten A
 Ɱ     - map across each integer I in that with:
ç      -   call the Helper Link as a dyad - f(A, I)
     Ɱ - map across each list in A with:
    @  -   with swapped arguments:
   ḟ   -     filter discard

Jelly, 15 bytes

ċƇf/>Ƈ⁹ȧ
çⱮFḟ@Ɱ

A monadic Link accepting a list of lists of strictly positive integers that yields a list of lists of strictly positive integers.

Try it online! (The footer calls the Link for each and formats the output)

How?

ċƇf/>Ƈ⁹ȧ - Helper Link: list of lists, A; integer, I
 Ƈ       - filter keep those lists in A for which:
ċ        -   count occurrences of I - truthy if the list contains I
   /     - reduce this list of lists that contain I by:
  f      -   filter keep - i.e. a list of those values appearing in all of them
      ⁹  - use I as the right argument of:
     Ƈ   -   filter keep those integers that appeared in all for which:
    >    -     greater than I?
       ȧ - logical AND (non-vectorising)
             - i.e. I if it is a consistently dependent smalle integer, else 0

çⱮFḟ@Ɱ - Link: list of lists, A
  F    - flatten A
 Ɱ     - map across each integer I in that with:
ç      -   call the Helper Link as a dyad - f(A, I)
     Ɱ - map across each list in A with:
    @  -   with swapped arguments:
   ḟ   -     filter discard

Jelly, 15 bytes

ċƇf/>Ƈ⁹ȧ
çⱮFḟ@Ɱ

A monadic Link accepting a list of lists of strictly positive integers that yields a list of lists of strictly positive integers.

Try it online! (The footer calls the Link for each and formats the output)

How?

ċƇf/>Ƈ⁹ȧ - Helper Link: list of lists, A; integer, I
 Ƈ       - filter keep those lists in A for which:
ċ        -   count occurrences of I - truthy if the list contains I
   /     - reduce this list of lists that contain I by:
  f      -   filter keep
             - gets us a list of those values appearing in all of them
      ⁹  - use I as the right argument of:
     Ƈ   -   filter keep those for which:
    >    -     greater than I?
       ȧ - logical AND I (non-vectorising)
             - i.e. I if it is a consistently dependent smaller integer, else 0

çⱮFḟ@Ɱ - Link: list of lists, A
  F    - flatten A
 Ɱ     - map across each integer I in that with:
ç      -   call the Helper Link as a dyad - f(A, I)
     Ɱ - map across each list in A with:
    @  -   with swapped arguments:
   ḟ   -     filter discard
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 15 bytes

ċƇf/>Ƈ⁹ȧ
çⱮFḟ@Ɱ

A monadic Link accepting a list of lists of strictly positive integers that yields a list of lists of strictly positive integers.

Try it online! (The footer calls the Link for each and formats the output)

How?

ċƇf/>Ƈ⁹ȧ - Helper Link: list of lists, A; integer, I
 Ƈ       - filter keep those lists in A for which:
ċ        -   count occurrences of I - truthy if the list contains I
   /     - reduce this list of lists that contain I by:
  f      -   filter keep - i.e. a list of those values appearing in all of them
      ⁹  - use I as the right argument of:
     Ƈ   -   filter keep those integers that appeared in all for which:
    >    -     greater than I?
       ȧ - logical AND (non-vectorising)
             - i.e. I if it is a consistently dependent smalle integer, else 0

çⱮFḟ@Ɱ - Link: list of lists, A
  F    - flatten A
 Ɱ     - map across each integer I in that with:
ç      -   call the Helper Link as a dyad - f(A, I)
     Ɱ - map across each list in A with:
    @  -   with swapped arguments:
   ḟ   -     filter discard