Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
6
Task/Repeat-a-string/Prolog/repeat-a-string-1.pro
Normal file
6
Task/Repeat-a-string/Prolog/repeat-a-string-1.pro
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
%repeat(Str,Num,Res).
|
||||
repeat(Str,1,Str).
|
||||
repeat(Str,Num,Res):-
|
||||
Num1 is Num-1,
|
||||
repeat(Str,Num1,Res1),
|
||||
string_concat(Str, Res1, Res).
|
||||
21
Task/Repeat-a-string/Prolog/repeat-a-string-2.pro
Normal file
21
Task/Repeat-a-string/Prolog/repeat-a-string-2.pro
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
:- system:set_prolog_flag(double_quotes,chars) .
|
||||
|
||||
repeat(SOURCEz0,COUNT0,TARGETz)
|
||||
:-
|
||||
prolog:phrase(repeat(SOURCEz0,COUNT0),TARGETz)
|
||||
.
|
||||
|
||||
%! repeat(SOURCEz0,COUNT0)//2
|
||||
|
||||
repeat(_SOURCEz0_,0)
|
||||
-->
|
||||
! ,
|
||||
[]
|
||||
.
|
||||
|
||||
repeat(SOURCEz0,COUNT0)
|
||||
-->
|
||||
SOURCEz0 ,
|
||||
{ COUNT is COUNT0 - 1 } ,
|
||||
repeat(SOURCEz0,COUNT)
|
||||
.
|
||||
Loading…
Add table
Add a link
Reference in a new issue