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

Pages: 1-

/prog/ challenge 2009: tskbot

Name: Anonymous 2022-04-14 19:31

Create a program which accepts a string on stdin, and outputs to stdout either the string ``tsk'', or an empty string. The formar case happens when the input string contains the substring ``nigger'' (case-insensitive). The latter happens in other cases.

Shortest program wins. You have 7*24 hours from the timestamp of this poast. Good luck!

Name: Anonymous 2022-04-15 1:59

(when (re-find #"(?i)nigger" (slurp *in*)) (println "tsk"))

Name: Anonymous 2022-04-15 8:03

>>2
how dare a sloppy fellow who slurps his *in*s use an elegant language such as lisp

Name: Anonymous 2022-04-15 9:04

use v5.10;while(<>){/nigger/i&&say"tsk"}

Name: Anonymous 2022-04-15 13:32

/nigger/i{print"tsk"}

Name: Anonymous 2022-04-15 14:03

>>4 /nigger/i&&print"tsk\n"while<> 30 bytes (perl)
>>5 tolower($1)~/nigger/{print"tsk"} 32 bytes (awk)

Name: Anonymous 2022-04-15 20:44

Would specifying flags for the program be cheating? If you do sed -n, you can do
s/nigger/tsk/ip
otherwise I need to add two characters more
s/nigger/tsk/ip;d
This requires GNU sed.

Name: Anonymous 2022-04-16 6:15

>>7
you can use any flags, but they add to the byte count

Name: Anonymous 2022-04-16 11:34

Can I include void.h?

Name: Anonymous 2022-04-16 15:06

>>9
All nonstandard includes and imports are counted towards the bytecount. void dot h is nonstandard.

Name: Anonymous 2022-04-18 0:10

while read line; do if echo "$line" | grep -i "hello"; then echo "world"; else echo; fi; done

Name: Anonymous 2022-04-18 0:20

nlsh> take input from stdin if string 'hello' is entered replace with 'world' otherwise print nothing
>>> Run: while read line; do if echo "$line" | grep -q "hello"; then echo "world"; else echo "$line"; fi; done [Y/n]: Y
aff
aff
hello
world
^Cnlsh> no i mean print out empty string if something else
>>> Run: while read line; do if echo "$line" | grep -q "hello"; then echo "world"; else echo; fi; done [Y/n]: Y
hello
world
foajfoa

^Cnlsh> make it case insensitive
>>> Run: while read line; do if echo "$line" | grep -i "hello"; then echo "world"; else echo; fi; done [Y/n]: Y

Name: Anonymous 2022-04-18 3:39

>>12
WAA WAAA WAAA SHRDLU NO LIKE WAAAH WAAH WAAAH

Name: Anonymous 2022-04-22 18:21

>>13
Then ALT+F4

Name: Anonymous 2022-04-23 18:06

So who won?

Name: Anonymous 2022-04-25 9:55

>>15
I did. I will now proceed to spill my champagne all over your crusty Remilia figurines.

Name: Anonymous 2022-04-25 10:47

>>15
Everybody who posted code is a winner.

Name: Anonymous 2022-04-25 12:22

tsmt

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