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.159 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.158 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.157 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.156 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.155 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.154 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.153 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.152 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.151 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.150 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.149 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.148 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.147 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.146 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.145 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.144 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.143 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.142 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.141 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example
trackler-2.2.1.140 tracks/prolog/exercises/pascals-triangle/pascals_triangle.example