Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

repetition

Name: Anonymous 2008-09-29 13:09

print "dongs" five times in your favorite language

with extreme conciseness/verbosity

Name: Anonymous 2008-09-30 0:52

5adongs

Name: Anonymous 2008-09-30 1:31

(define (five-dongs)
  (letrec ((n-dongs (lambda (num results)
                      (cond ((> num 0) (n-dongs (- num 1) (append results '(dongs))))
                            (else results)))))
    (display (n-dongs 5 '()))))

Name: Anonymous 2008-09-30 2:36

main = mapM_ putStrLn $ replicate 5 "dongs"

Name: Anonymous 2008-09-30 2:48

>>42
Why would you abstract away dong repetition but not repetition in general?  Or fuck, repetition can just be an enumeration sort of thing with a many-to-one function.
Here:
(define (enumerate current high function results)
  (cond ((< current high)
         (enumerate (+ current 1) high function (append results (list (function current)))))
        (else results)))

(define (repeat-dongs n)
  (enumerate 0 n (lambda (x) 'dongs) '()))

(define (five-dongs)
  (repeat-dongs 5))

(display (five-dongs))

Name: Anonymous 2008-09-30 3:08

(define (enumerate current high comparator incrementor mapper results)
  (cond ((comparator current high)
         (enumerate (incrementor current) high comparator incrementor mapper (append results (list (mapper current)))))
        (else results)))

(define (repeat something n)
  (enumerate 0 n (lambda (x y) (< x y)) (lambda (x) (+ 1 x)) (lambda (x) something) '()))

(define (repeat-dongs n)
  (repeat 'dongs n))

(define (five-dongs)
  (repeat-dongs 5))

(display (five-dongs))

Name: Anonymous 2008-09-30 4:07

>>45
I lol'd

Name: Anonymous 2008-09-30 4:35

for %% in (0 0 0 0 0) do @echo dongs

Name: Anonymous 2008-09-30 5:41

>>46
What's so funny?

Name: Anonymous 2008-09-30 6:37

<!DOCTYPE html>
<title></title>
<ul>
<li>dongs</li>
<li>dongs</li>
<li>dongs</li>
<li>dongs</li>
<li>dongs</li>
</ul>

Name: Anonymous 2008-09-30 8:16

>>48
Enterprise-ready Scalable Expandable Turkey LISP repeat-dongs Reference Implementation

Name: Anonymous 2008-09-30 9:35

:echo repeat("dongs ", 5)

Name: Anonymous 2008-09-30 9:52

print 'dongs ' * 5

Name: "GRUNNUR" 2008-09-30 10:27

"GRUNNUR"

Name: Anonymous 2008-09-30 10:31

yes dongs | head -n5

Name: Anonymous 2008-09-30 10:34


class Dong():
    def __init__(self):
        self.text = 'dongs'
    def dong(self):
        print self.text

dongs = [Dong()]*5

for dong in dongs:
    dong.dong()

Name: Anonymous 2008-09-30 10:53

#include <iostream>
#include <string>
#include <vector>

int main(void)
{
   std::vector<std::string> d(5, "dongs ");
   std::vector<std::string>::iterator dicks = d.begin();
   while(dicks != d.end())
   {
      std::cout << *dicks;
      ++dicks;
   }
   std::cout << std::endl;
   return 0;
}

Name: Anonymous 2008-09-30 10:55

>>56
Whopps, code tags.

#include <iostream>
#include <string>
#include <vector>

int main(void)
{
   std::vector<std::string> d(5, "dongs ");
   std::vector<std::string>::iterator dicks = d.begin();
   while(dicks != d.end())
   {
      std::cout << *dicks;
      ++dicks;
   }
   std::cout << std::endl;
   return 0;
}

Name: Anonymous 2008-09-30 12:21


section .data
msg db "dong",10,0

section .text
extern printf
global main
main:
    mov ebx, 5
    dongloop:
    push msg
    call printf
    add esp,8
    dec ebx
    jnz dongloop
        mov eax, 1
        int 80h

Name: Anonymous 2008-09-30 12:50


section .data
dong:   db "dong", 10
donglen equ $-dong

section .text
    global _start
_start:
    mov ecx, 5
.dong
    push ecx
    mov eax, 4
    mov ebx, 1
    mov ecx, dong
    mov edx, donglen
    int 80h
    pop ecx
    loop .dong

    mov eax, 1
    xor eax, eax
    int 80h

Name: Anonymous 2008-09-30 13:47


 ldx #$ff
 bne :++
: jsr $ffd2
: inx
  lda text,x
  bne :--
 rts

text: "dongs",13,0

Name: Anonymous 2008-09-30 13:49

>>60
Oh fuck! forgot about the 5x!


 ldy #4
: ldx #$ff
  bne :++
:  jsr $ffd2
:  inx
   lda text,x
   bne :--
  dey
  bpl :---
 rts

text: "dongs",13,0

Name: Anonymous 2008-09-30 13:55

донгс донгс донгс донгс донгс

Name: Anonymous 2008-09-30 14:10

>>62
valid perl code

Name: Anonymous 2008-09-30 14:34

puts "ᛞᛟᛝᛋ᛫ᛞᛟᛝᛋ᛫ᛞᛟᛝᛋ᛫ᛞᛟᛝᛋ᛫ᛞᛟᛝᛋ᛬"
puts "᚛ᚂᚑᚍᚄ ᚂᚑᚍᚄ ᚂᚑᚍᚄ ᚂᚑᚍᚄ ᚂᚑᚍᚄ᚜"

Name: Anonymous 2008-09-30 14:52

>>55
dong.dong()

Name: Anonymous 2008-09-30 15:05

>>59
eax = 0, int 80h. enjoy your segmentation fault.

Name: Anonymous 2008-09-30 15:18

>>66
I prefer General Protection Fault.

Name: Anonymous 2008-09-30 15:23

#include <iostream>

template <int N>
class dongs {
public:
    dongs() {
        std::cout << "dongs";
    }
private:
    dongs<N - 1> dong;
};

template <>
struct dongs<0> {
};

int main()
{
    dongs<5>();
    return 0;
}

Name: Anonymous 2008-09-30 15:51

recursion <3

public class main{
public static void main(String[] args){

    dongs(5);

}

public static void dongs(int n){
    dongs(n-1);

    if(n > 0)
        System.out.println("dongs");
    else
        return;
}
}

Name: Anonymous 2008-09-30 15:59

#/bin/bash
echo "dongs"
echo "dongs"
echo "dongs"
echo "dongs"
echo "dongs"
echo "dongs"
exit

Name: Anonymous 2008-09-30 16:35

#define dongs(pos) printf(&pos##ix["\021\045-000000000songs\012\0posix"],(pos##ix)["monkey"]+"food"-0x6c);
main(){dongs(un) dongs(un) dongs(un) dongs(un) dongs(un)}

Name: Anonymous 2008-09-30 16:36

>>68
I think mine is better:

#include <iostream>
#include <string>

template < int N > struct dongs { static const std::string v; };
template < int N > const std::string dongs<N>::v = dongs< N - 1 >::v + "dongs";

template <> struct dongs<0> { static const std::string v; };
const std::string dongs<0>::v = "";

int main() {
        std::cout << dongs<5>::v;
        return 0;
}

Name: Anonymous 2008-09-30 16:44

5>0" sgnod">,:v    
 ^_@#:-1 $_^#!<

Name: Anonymous 2008-09-30 16:44

CREATE TABLE Dong (
   dongid INTEGER AUTO_INCREMENT,
   dong   VARCHAR2(5),
   PRIMARY KEY(dongid)
);

CREATE OR REPLACE PROCEDURE InsertDongs(numDongs IN INTEGER) AS

   invalidParameter EXCEPTION;

   BEGIN

      IF numDongs IS NULL THEN RAISE invalidParameter
      END IF;
      IF numDongs < 1 THEN RAISE invalidParameter
      END IF;

      FOR i IN 1 .. numDongs LOOP

         INSERT INTO Dong(dong)
         VALUES('dongs');
  
      END LOOP;

      EXCEPTION

         WHEN invalidParameter THEN DBMS_OUTPUT.PUT_LINE('bad paramter recieved');
         WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(SQLERRM);

   END;
END InsertDongs;

IsertDongs(5);

SELECT dong
FROM   Dong;

Name: Anonymous 2008-09-30 17:14

>>72

#include <iostream>
#include <string>

template < int N > struct dongs { static const std::string v; };

template < int N > const std::string dongs<N>::v = dongs< N - 1 >::v + "dongs";
template <>        const std::string dongs<0>::v = "";

int main() {
        std::cout << dongs<5>::v;
        return 0;
}


OPTMIZED

Name: Anonymous 2008-09-30 17:56

#include<stdio.h> void main(){for(i = 5; i > 0; --i, printf("dongs");}

Name: Anonymous 2008-09-30 18:14

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IsertDongs(5)' at line 35

Name: Anonymous 2008-09-30 19:39

[code]dongs
dongs
dongs
dongs
dongs[code]


[spoiler]in English[/spoiler]

Name: Anonymous 2008-09-30 21:13

>>77
meh, just a typo.

and btw, >>74 was written with Oracle 10g in mind. fuck MySQL

Name: Anonymous 2008-10-01 2:22

<script language="javascript" type="text/javascript">
 <!--
     for(var i=0; i < 5; i++)
         document.writeln("Dongs");
 //-->
</script>

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List