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

/prog/ challenge: ``proper quotes''

Name: Anonymous 2008-08-12 20:08

Write a program that takes a text file and converts adirectional quotes into `` and '', i.e.

INPUT:
I turned my head around, with that casual smile all over my face.
"The stuff you said in your intro, how much of it was serious?"
With her arms crossed in front of her chest, lips sealed tight,
Suzumiya Haruhi kept her stern posture, staring right into my eyes.
"What 'stuff in my intro?'"
"The stuff about the aliens and all that."
"Are you an alien?"


OUTPUT:
I turned my head around, with that casual smile all over my face.
``The stuff you said in your intro, how much of it was serious?''
With her arms crossed in front of her chest, lips sealed tight,
Suzumiya Haruhi kept her stern posture, staring right into my eyes.
``What 'stuff in my intro?'''
``The stuff about the aliens and all that.''
``Are you an alien?''


Use whatever language you want. Bonus points for creativity and efficiency.

I'll start:
#include <stdio.h>

char *q[]= {"''", "``"};
main() {
 int c, i=0;
 while((c=getchar())!=EOF) {
  if(c=='"')
   printf("%s",q[i^=1]);
  else
   putchar(c);
 }
}

Name: Anonymous 2008-08-16 17:35

This discussion is becoming way too retarded.

Name: Anonymous 2008-08-16 17:52

most software assumes memory is infinite.
that's why we need 4GB of memory to do the same things we could do with just 32MB 10 years ago.

Name: Anonymous 2008-08-16 17:55

>>82
That's not what he was talking about.

Name: Anonymous 2008-08-16 18:35

You guys are confusing turing machines and programs again.

Good show.

Name: Anonymous 2008-08-16 19:01

import Control.Monad.Instances
import Array
import List

main = interact $ \text ->
   concat $ zipWith (flip ($)) text $ (++ repeat (:[])) $ concat
          $ zipWith ((.) (tail . reverse) . (:) . const) (cycle ["``","''"])
          $ map (flip replicate (:[])) $ (zipWith (-) =<< tail)
          $ (-1): elemIndices '"' text

Name: Anonymous 2008-08-16 19:02

import Control.Monad.Instances
import List

main = interact $ \text ->
   concat $ zipWith ((. tail) . (++)) ("": cycle ["``","''"])
          $ snd $ mapAccumL ((.) (uncurry $ flip (,)) . flip splitAt) (undefined: text)
          $ (zipWith (-) =<< tail) $ (-1): elemIndices '"' (text ++ "\"")

Name: Anonymous 2008-08-16 19:16

Does every single HASKELL program have to be a linear sequence of functions applied to the argument? :/

Name: Anonymous 2008-08-16 19:29

>>87
Fuck you. You don't know my nomads like I do.

Name: Anonymous 2008-08-16 19:33

>>88
I do not; this is why I wonder.

Name: Anonymous 2008-08-16 19:59

>>87
These don't: >>12,21-23

Name: 86 2008-08-16 20:06

>>87
They don't, I just write them like that because I don't like naming stuff.

Name: Anonymous 2008-08-16 20:11

>>88
I tried to rape my mom in bed, then realized I was giving my dad anal. Still came, though.

Name: Anonymous 2008-08-16 20:23

>>92
moar

Name: Anonymous 2008-08-16 20:33

>>90
Yeah, I like these and that is how I would do it.

Name: Anonymous 2008-08-16 22:17

I started writing a Python program, but I felt too gay about turning decent quotes into shit quotes.

Name: Anonymous 2008-08-16 22:40

I started writing a Python program, but I felt too gay
Python program, but I felt too gay
Python, gay

Name: Anonymous 2008-08-17 5:56

       +>>++++[<++++>-]<[<++++++>-]+[<[>>>>+<<<<-]>>>>[<<<<+>>>>>>+<<-]<+
   +++[>++++++++<-]>.[-]<+++[>+++<-]>+[>>.+<<-]>>[-]<<<++[<+++++>-]<.<<[>>>>+
 <<<<-]>>>>[<<<<+>>>>>>+<<-]<<[>>>>.+<<<++++++++++[<[>>+<<-]>>[<<+>>>>>++++++++
 +++<<<-]<[>+<-]>[<+>>>>+<<<-]>>>[>>>>>>>>>>>>+>+<<     <<<<<<<<<<<-]>>>>>>>>>>
>>[-[>>>>+<<<<-]>[>>>>+<<<<-]>>>]>      >>[<<<+>>  >-    ]<<<[>>+>+<<<-]>[->[<<<
<+>>>>-]<[<<<  <+>      >>>-]<<<< ]<     ++++++  ++       +[>+++++<-]>>[<<+>>-]<
<[>---<-]>.[- ]         <<<<<<<<< <      <<<<<< <         -]++++++++++.[-]<-]>>>
>[-]<[-]+++++           +++[>++++        ++++<     -     ]>--.[-]<,----------[<+
>-]>>>>>>+<<<<< <     <[>+>>>>>+>[      -]<<<      <<   <<-]>++++++++++>>>>>[[-]
<<,<<<<<<<->>>> >    >>[<<<<+>>>>-]<<<<[>>>>+      >+<<<<<-]>>>>>----------[<<<<
<<<<+<[>>>>+<<<      <-]>>>>[<<<<+>>>>>>+<<-      ]>[>-<-]>++++++++++[>+++++++++
++<-]<<<<<<[>>>      >+<<<<-]>>>>[<<<<+>>>>>      >+<<-]>>>>[<<->>-]<<++++++++++
[>+<-]>[>>>>>>>      >>>>>+>+<<<<      <<<<<      <<<<-]>>> >>     >>>>>>>[-[>>>
>+<<<<-]>[>>>>       +<<<<-]>> >       ]>> >           [<< <        +>>>-]+<<<[>
>>-<<<-]>[->[<      <<<+>>>>-]         <[ <            < <           <+>>>>-]<<<
<]<<<<<<<<<<<, [    -]]>]>[-+++        ++               +    +++     ++[>+++++++
++++>+++++++++ +    +<<-]>[-[>>>      +<<<-      ]>>>[ <    <<+      >>>>>>>+>+<
<<<<-]>>>>[-[> >    >>+<<<<-]>[>      >>>+< <    <<-]> >    >]>      >>[<<<+>>>-
]<<<[>>+>+<<< -     ]>[->[<<<<+>      >>>-] <    [<<< <    +>>       >>-]<<<<]<<
<<<<<<[>>>+<< <     -]>>>[<<<+>>      >>>>> +    >+<< <             <<-]<<[>>+<<
-]>>[<<+>>>>>      >+>+<<<<<-]>>      >>[-[ >    >>>+ <            <<<-]>[>>>>+<
<<<-]>[>>>>+<      <<<-]>>]>>>[ -    ]<[>+< -    ]<[ -           [<<<<+>>>>-]<<<
<]<<<<<<<<]<<      <<<<<<<<++++ +    +++++  [   >+++ +    ++++++[<[>>+<<-]>>[<<+
>>>>>++++++++ +    ++<<<     -] <    [>+<- ]    >[<+ >    >>>+<<<-]>>>[<<<+>>>-]
<<<[>>>+>>>>  >    +<<<<     <<      <<-]> >    >>>>       >>>[>>+<<-]>>[<<+<+>>
>-]<<<------ -    -----[     >>      >+<<< -    ]>>>       [<<<+> > >>>>>+>+<<<<
<-]>>>>[-[>> >    >+<<<<    -] >     [>>>> +    <<<<-       ]>>> ]  >>>[<<<+>>>-
]<<<[>>+>+<< <    -]>>>     >>           > >    [<<<+               >>>-]<<<[>>>
+<<<<<+>>-                  ]>           >     >>>>>[<             <<+>>>-]<<<[>
>>+<<<<<<<                  <<+         >      >>>>>-]<          <<<<<<[->[<<<<+
>>>>-]<[<<<<+>>>>-]<<<<]>[<<<<<<    <+>>>      >>>>-]<<<<     <<<<<+++++++++++[>
>>+<<<-]>>>[<<<+>>>>>>>+>+<<<<<-]>>>>[-[>     >>>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<
+>>>-]<<<[>>+>+<<<-]>>>>>>>[<<<+>>>-]<<<[     >>>+<<<<<+>>-]>>>>>>>[<<<+>>>-]<<<
[>>>+<<<<<<<<<+>>>>>>-]<<<<<<<[->[< <  <     <+>>>>-]<[<<<<+>>>>-]<<<<]>[<<<<<<<
+>>>>>>>-]<<<<<<<<<+++++++++++[>>> >        >>>+>+<<<<<<<<-]>>>>>>>[-[>>>>+<<<<-
]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-]<<< [       >>+>+<<<-]>>>>>>>[<<<+>>>-]<<<[>>>+<<
<<<+>>-]>>>>>>>[<<<+>>>-]<<<[>>>+<        <<<<<<<<+>>

Name: Anonymous 2008-08-17 7:35

more like
       +>>++++[<++++>-]<[<++++++>-]+[<[>>>>+<<<<-]>>>>[<<<<+>>>>>>+<<-]<+
   +++[>++++++++<-]>.[-]<+++[>+++<-]>+[>>.+<<-]>>[-]<<<++[<+++++>-]<.<<[>>>>+
 <<<<-]>>>>[<<<<+>>>>>>+<<-]<<[>>>>.+<<<++++++++++[<[>>+<<-]>>[<<+>>>>>++++++++
 +++<<<-]<[>+<-]>[<+>>>>+<<<-]>>>[>>>>>>>>>>>>+>+<<     <<<<<<<<<<<-]>>>>>>>>>>
>>[-[>>>>+<<<<-]>[>>>>+<<<<-]>>>]>      >>[<<<+>>  >-    ]<<<[>>+>+<<<-]>[->[<<<
<+>>>>-]<[<<<  <+>      >>>-]<<<< ]<     ++++++  ++       +[>+++++<-]>>[<<+>>-]<
<[>---<-]>.[- ]         <<<<<<<<< <      <<<<<< <         -]++++++++++.[-]<-]>>>
>[-]<[-]+++++           +++[>++++        ++++<     -     ]>--.[-]<,----------[<+
>-]>>>>>>+<<<<< <     <[>+>>>>>+>[      -]<<<      <<   <<-]>++++++++++>>>>>[[-]
<<,<<<<<<<->>>> >    >>[<<<<+>>>>-]<<<<[>>>>+      >+<<<<<-]>>>>>----------[<<<<
<<<<+<[>>>>+<<<      <-]>>>>[<<<<+>>>>>>+<<-      ]>[>-<-]>++++++++++[>+++++++++
++<-]<<<<<<[>>>      >+<<<<-]>>>>[<<<<+>>>>>      >+<<-]>>>>[<<->>-]<<++++++++++
[>+<-]>[>>>>>>>      >>>>>+>+<<<<      <<<<<      <<<<-]>>> >>     >>>>>>>[-[>>>
>+<<<<-]>[>>>>       +<<<<-]>> >       ]>> >           [<< <        +>>>-]+<<<[>
>>-<<<-]>[->[<      <<<+>>>>-]         <[ <            < <           <+>>>>-]<<<
<]<<<<<<<<<<<, [    -]]>]>[-+++        ++               +    +++     ++[>+++++++
++++>+++++++++ +    +<<-]>[-[>>>      +<<<-      ]>>>[ <    <<+      >>>>>>>+>+<
<<<<-]>>>>[-[> >    >>+<<<<-]>[>      >>>+< <    <<-]> >    >]>      >>[<<<+>>>-
]<<<[>>+>+<<< -     ]>[->[<<<<+>      >>>-] <    [<<< <    +>>       >>-]<<<<]<<
<<<<<<[>>>+<< <     -]>>>[<<<+>>      >>>>> +    >+<< <             <<-]<<[>>+<<
-]>>[<<+>>>>>      >+>+<<<<<-]>>      >>[-[ >    >>>+ <            <<<-]>[>>>>+<
<<<-]>[>>>>+<      <<<-]>>]>>>[ -    ]<[>+< -    ]<[ -           [<<<<+>>>>-]<<<
<]<<<<<<<<]<<      <<<<<<<<++++ +    +++++  [   >+++ +    ++++++[<[>>+<<-]>>[<<+
>>>>>++++++++ +    ++<<<     -] <    [>+<- ]    >[<+ >    >>>+<<<-]>>>[<<<+>>>-]
<<<[>>>+>>>>  >    +<<<<     <<      <<-]> >    >>>>       >>>[>>+<<-]>>[<<+<+>>
>-]<<<------ -    -----[     >>      >+<<< -    ]>>>       [<<<+> > >>>>>+>+<<<<
<-]>>>>[-[>> >    >+<<<<    -] >     [>>>> +    <<<<-       ]>>> ]  >>>[<<<+>>>-
]<<<[>>+>+<< <    -]>>>     >>           > >    [<<<+               >>>-]<<<[>>>
+<<<<<+>>-                  ]>           >     >>>>>[<             <<+>>>-]<<<[>
>>+<<<<<<<                  <<+         >      >>>>>-]<          <<<<<<[->[<<<<+
>>>>-]<[<<<<+>>>>-]<<<<]>[<<<<<<    <+>>>      >>>>-]<<<<     <<<<<+++++++++++[>
>>+<<<-]>>>[<<<+>>>>>>>+>+<<<<<-]>>>>[-[>     >>>+<<<<-]>[>>>>+<<<<-]>>>]>>>[<<<
+>>>-]<<<[>>+>+<<<-]>>>>>>>[<<<+>>>-]<<<[     >>>+<<<<<+>>-]>>>>>>>[<<<+>>>-]<<<
[>>>+<<<<<<<<<+>>>>>>-]<<<<<<<[->[< <  <     <+>>>>-]<[<<<<+>>>>-]<<<<]>[<<<<<<<
+>>>>>>>-]<<<<<<<<<+++++++++++[>>> >        >>>+>+<<<<<<<<-]>>>>>>>[-[>>>>+<<<<-
]>[>>>>+<<<<-]>>>]>>>[<<<+>>>-]<<< [       >>+>+<<<-]>>>>>>>[<<<+>>>-]<<<[>>>+<<
<<<+>>-]>>>>>>>[<<<+>>>-]<<<[>>>+<        <<<<<<<<+>>

Name: Anonymous 2008-08-17 8:23

>>98
Very nice, and how long did that take?

Name: Anonymous 2008-08-17 8:33

>>98
I jizzed.

Name: Anonymous 2008-08-17 18:05

Name: Anonymous 2008-08-17 18:51

What if we had a C compiler for Brainfuck? We could compile C code to portable bytecode and run it on a Brainfuck Virtual Machine on any hardware; compile once - run everywhere. I foresee a great future for this.

Name: Anonymous 2008-08-17 18:55

>>102
in b4 java

Name: Anonymous 2008-08-17 21:40

>>102
Only trivially small programs could be compiled, as the number of < and > needed to access a given memory location would increase as n2 where n is the number of bytes of memory needed.

Name: Anonymous 2008-08-17 23:10

>>104
also, things like sockets and file i/o are impossible in brainfuck.

a haskell to brainfuck compiler might be possible, tho, since you can't do those things in haskell either.

Name: Anonymous 2010-12-21 1:50

Name: Anonymous 2011-11-30 11:07

FUCK WEEABOO YOU WON'T GET A THIRD SEASON OF HARUHI SHIT


HAAAAAHAAHAHAHAAH

Name: Anonymous 2011-11-30 11:37

>>107
anime

Name: Anonymous 2011-11-30 12:25

actually contributing
brainfuck
++++++++++[->++
++>++++++++++<<
]>->---->,[[->+
>+<<]++++++[->-
-----<]+>++[<->
>.<[-]]>[-]<<[-
<..[->+<]<[->+<
]>>[-<<+>>]],]

Name: Anonymous 2011-11-30 12:34

>>47
unoptimized shit. check my version
>>109

Name: Anonymous 2011-11-30 12:43

,[                                    ;while (t0 = getc)
                                     
  >[-]<                               ;t1 = 0
  [->+>+<<]>>[-<<+>>]                 ;inc t1 by t0 using t2
  < ----- ----- ----- -----
    ----- ----- ----                  ;t1 = (t1 != 34)
  >+<[                                ;if t1 (using t2 and t3) then
    <.>                                ;print t0
  >-]>[<                              ;else
    >>>                                ;move to t4
    >+<[                               ;if t4 (using t5 and t6) then
      >>>                               ;move to t7
      [-] +++++ +++++ +++++ +++++
          +++++ +++++ +++++ ++++  ..    ;print ''
      <<<                               ;move to t4
      -                                 ;t4 = 0
    >-]>[<                             ;else
      >>>                               ;move to t7
      [-] +++++ +++++ +++++ +++++
          +++++ +++++ +++++ +++++
          +++++ +++++ +++++ +++++
          +++++ +++++ +++++ +++++
          +++++ +++++ +++++ +     ..    ;print ``
      <<<                               ;move to t4
      +                                 ;t4 = 1
    >->]<<                             ;end if
    <<<                                ;move to t1
  >->]<<                              ;end if
<,]

Name: Anonymous 2011-11-30 19:50

>>111
sweet triples bro

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