Tee suosikkikielelläsi ohjelma, joka tulostaa ruudulle seuraavan tekstin:
"text", 'text' and ´text´ usually end before the next \n, while """multi '''or this <<EOF ": line""" one''' as well as heredocs and string EOF block literals may include newlines. Python's "foo""""bar""" and "foo""bar" are foobar but strangely enough, """""bar""" is ""bar and """bar" # waits for """ (like this 'comment') \\ is usually used to mark \ which itself is used for various escape sequences. /Raw strings/ such as r'this\not\escaped' try to treat \ as \ but may add other escapes like ""/'' for "&' and often they still escape depending on location. You may have been bitten by C:\Windows\
Tekstiä ei saa lukea tiedostosta tai vastaavaa, vaan se pitää sisällyttää lähdekoodiin.
Sitten tee ohjelma, joka tulostaa ensimmäisen ohjelmasi lähdekoodin ruudulle,
ja postaa se tänne :)
Lisäys:
Hommaan palkinnon eniten fucked up, mutta toimivan ja järkeenkäyvän ratkaisun postanneelle.
Itse puuhailen parhaillaan Nim-ohjelmointikielen parissa, joten referenssiratkaisuna siitä miten ei ainakaan voita:
stdout.write r": stdout.write r": "text", 'text' and ´text´ usually end before the next \n, while """multi '''or this <<EOF ": line""" one''' as well as heredocs and string EOF block literals may include newlines. Python's "foo""""bar""" and "foo""bar" are foobar but strangely enough, """""bar""" is ""bar and """bar" # waits for """ (like this 'comment') \\ is usually used to mark \ which itself is used for various escape sequences. /Raw strings/ such as r'this\not\escaped' try to treat \ as \ but may add other escapes like ""/'' for "&' and often they still escape depending on location. You may have been bitten by C:\Windows\
Tässäpä SQL-versio sillä rajoituksella, että SQL ei itsessään tulosta mitään ja useimmat clientit esittää queryn tuloksen jonkinlaisena taulukkona. Mutta jos queryn tulos lasketaan outputiksi, niin sitten tämän pitäisi ajaa asiansa.
select '"text", ''text'' and ´text´ usually end before the next \\n, while """multi ''''''or this <<EOF ": line""" one'''''' as well as heredocs and string EOF block literals may include newlines. Python''s "foo""""bar""" and "foo""bar" are foobar but strangely enough, """""bar""" is ""bar and """bar" # waits for """ (like this ''comment'') \\\\ is usually used to mark \\ which itself is used for various escape sequences. /Raw strings/ such as r''this\\not\\escaped'' try to treat \\ as \\ but may add other escapes like ""/'''' for "&'' and often they still escape depending on location. You may have been bitten by C:\\Windows\\' as temp;
select 'select ''"text", ''''text'''' and ´text´ usually end before the next \\\\n, while """multi ''''''''''''or this <<EOF ": line""" one'''''''''''' as well as heredocs and string EOF block literals may include newlines. Python''''s "foo""""bar""" and "foo""bar" are foobar but strangely enough, """""bar""" is ""bar and """bar" # waits for """ (like this ''''comment'''') \\\\\\\\ is usually used to mark \\\\ which itself is used for various escape sequences. /Raw strings/ such as r''''this\\\\not\\\\escaped'''' try to treat \\\\ as \\\\ but may add other escapes like ""/'''''''' for "&'''' and often they still escape depending on location. You may have been bitten by C:\\\\Windows\\\\'' as temp;' as temp;
Erikoisesta kielestä huolimatta suhteellisen normaalit escapoinnit ja etenkin backslashit paukkuvat kivasti. Rivinvaihdot sellaisenaan ja yksinkertainen lainausmerkki literaalina helpottivat tilannetta verrattuna moniin muihin kieliin.
Olisi mukava nyt kuitenkin nähdä vielä jokin muukin toteutus, jonkin muun kielen erityispiirteillä höystettynä.
Jukkah voitti parhaana suorituksena... Lähetä osoite pm niin laitan palkinnon tulemaan :)
Otetaan nyt vielä JavaScriptillä toinen esimerkki, niin ei voida sanoa, että voitin ainoalla suorituksella. :D
console.log(`"text", 'text' and ´text´ usually end before the next \\n, while """multi '''or this <<EOF ": line""" one''' as well as heredocs and string EOF block literals may include newlines. Python's "foo""""bar""" and "foo""bar" are foobar but strangely enough, """""bar""" is ""bar and """bar" # waits for """ (like this 'comment') \\\\ is usually used to mark \\ which itself is used for various escape sequences. /Raw strings/ such as r'this\\not\\escaped' try to treat \\ as \\ but may add other escapes like ""/'' for "&' and often they still escape depending on location. You may have been bitten by C:\\Windows\\`)
console.log(`console.log(\`"text", 'text' and ´text´ usually end before the next \\\\n, while """multi '''or this <<EOF ": line""" one''' as well as heredocs and string EOF block literals may include newlines. Python's "foo""""bar""" and "foo""bar" are foobar but strangely enough, """""bar""" is ""bar and """bar" # waits for """ (like this 'comment') \\\\\\\\ is usually used to mark \\\\ which itself is used for various escape sequences. /Raw strings/ such as r'this\\\\not\\\\escaped' try to treat \\\\ as \\\\ but may add other escapes like ""/'' for "&' and often they still escape depending on location. You may have been bitten by C:\\\\Windows\\\\\`)`)
Ps. Hankala ilmoittaa sulle mun osoitetta, kun en nää sun sähköpostiosoitetta. Ei kai tänne ole kuitenkaan mitään chattia rakennettu?
Vai puuttuu täältä se toiminto. No nakkaa sitten ljkarkk2@cc.hut.fi.
Missäköhän vaiheessa tuon haasteessa olleen tekstin ` oli kääntynyt väärinpäin... Meni ehkä liian helposti Javascriptissä nyt sen vuoksi :)
Aihe on jo aika vanha, joten et voi enää vastata siihen.