Sha256: 85d73c993de4e9ab1f60e53537dc1d257f38a82a69faa7df33520bd0f252cdda

Contents?: true

Size: 270 Bytes

Versions: 59

Compression:

Stored size: 270 Bytes

Contents

pascal(0, []) :- !.
pascal(X, P)  :-
  numlist(1, X, NL),
  maplist(pascalH, NL, P).

pascalH(1, [1])   :- !.
pascalH(N, [X|L]) :-
  succ(N1, N),
  pascalH(N1, [X|L1]),
  build([X|L1], L), !.

build([X],     [X]).
build([X,Y|Z], [H|R]) :-
  H is X+Y,
  build([Y|Z], R).

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.138 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.137 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.136 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.135 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.134 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.133 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.132 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.131 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.130 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.129 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.128 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.127 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.126 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.125 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.124 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.123 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.122 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.121 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example