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.180 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.179 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.178 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.177 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.176 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.175 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.174 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.173 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.172 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.171 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.170 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.169 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.167 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.166 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.165 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.164 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.163 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.162 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.161 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.160 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example