Repeat a string: Difference between revisions
Content added Content deleted
(Added Quackery) |
Drkameleon (talk | contribs) No edit summary |
||
Line 202: | Line 202: | ||
=={{header|Arturo}}== |
=={{header|Arturo}}== |
||
<lang rebol>print repeat "ha" 5</lang> |
|||
<lang arturo>str: "ha" * 5 |
|||
print str</lang> |
|||
{{out}} |
{{out}} |
||
<pre>hahahahaha</pre> |
<pre>hahahahaha</pre> |
||
=={{header|ATS}}== |
|||
<lang ATS> |
|||
// |
|||
// How to compile: |
|||
// patscc -DATS_MEMALLOC_LIBC -o string_repeat string_repeat.dats |
|||
// |
|||
#include |
|||
"share/atspre_staload.hats" |
|||
fun |
|||
string_repeat |
|||
( |
|||
x: string, n: intGte(0) |
|||
) : Strptr1 = res where |
|||
{ |
|||
val xs = |
|||
list_make_elt<string>(n, x) |
|||
val res = stringlst_concat($UNSAFE.list_vt2t(xs)) |
|||
val ((*freed*)) = list_vt_free(xs) |
|||
} (* end of [string_repeat] *) |
|||
(* ****** ****** *) |
|||
implement |
|||
main0 () = let |
|||
// |
|||
val ha5 = string_repeat("ha", 5) |
|||
val ((*void*)) = println! ("ha5 = \"", ha5, "\"") |
|||
val ((*freed*)) = strptr_free (ha5) |
|||
// |
|||
in |
|||
// nothing |
|||
end // end of [main0] |
|||
</lang> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |