Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,3 @@
#include <String.au3>
ConsoleWrite(_StringRepeat("ha", 5) & @CRLF)

View file

@ -1 +1,2 @@
(princ (repeat-string 5 "hi"))
(defun repeat-string (n string)
(format nil "~V@{~a~:*~}" n string))

View file

@ -1 +1 @@
(make-string 5 :initial-element #\X)
(princ (repeat-string 5 "hi"))

View file

@ -0,0 +1 @@
(make-string 5 :initial-element #\X)

View file

@ -0,0 +1,2 @@
$ write sys$output f$fao( "!AS!-!AS!-!AS!-!AS!-!AS", "ha" )
$ write sys$output f$fao( "!12*d" )

View file

@ -0,0 +1,12 @@
function nreps(s, n) {
var o = '';
if (n < 1) return o;
while (n > 1) {
if (n & 1) o += s;
n >>= 1;
s += s;
}
return o + s;
}
nreps('ha', 50000);

View file

@ -0,0 +1,3 @@
fun main(args: Array<String>) {
println("ha".repeat(5))
}

View file

@ -1 +1 @@
function repeats(s, n) return n > 0 and s .. repeat(s, n-1) or "" end
function repeats(s, n) return n > 0 and s .. repeats(s, n-1) or "" end

View file

@ -1,8 +1,8 @@
let string_repeat s n =
let len = String.length s in
let res = String.create(n * len) in
let len = Bytes.length s in
let res = Bytes.create(n * len) in
for i = 0 to pred n do
String.blit s 0 res (i * len) len;
Bytes.blit s 0 res (i * len) len
done;
(res)
Bytes.to_string res (* not stricly necessary, the bytes type is equivalent to string except mutability *)
;;

View file

@ -1,2 +1 @@
# string_repeat "Hiuoa" 3 ;;
- : string = "HiuoaHiuoaHiuoa"
val string_repeat : bytes -> int -> string = <fun>

View file

@ -1,3 +1,2 @@
let string_repeat s n =
String.concat "" (Array.to_list (Array.make n s))
;;
# string_repeat "Hiuoa" 3 ;;
- : string = "HiuoaHiuoaHiuoa"

View file

@ -1,3 +1,3 @@
let string_repeat s n =
Array.fold_left (^) "" (Array.make n s)
String.concat "" (Array.to_list (Array.make n s))
;;

View file

@ -1 +1,3 @@
String.make 5 '*'
let string_repeat s n =
Array.fold_left (^) "" (Array.make n s)
;;

View file

@ -0,0 +1 @@
String.make 5 '*'

View file

@ -0,0 +1 @@
std::iter::repeat("ha").take(5).collect::<String>(); // ==> "hahahahaha"

View file

@ -0,0 +1 @@
(String new:n) atAllPut:$*

View file

@ -1,2 +1,2 @@
width=72; char='='
head -c ${width} < /dev/zero | tr '\0' "$char"
len=12; str='='
repeat $len printf "$str"

View file

@ -0,0 +1,2 @@
width=72; char='='
head -c ${width} < /dev/zero | tr '\0' "$char"