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

Pages: 1-4041-

/prog/ challenge #6001: FIOC

Name: Christopher 2017-10-21 9:05

Input: A four-letter ASCII string
Output: The phrase ``αorced αndendation αf αode'',
with the alphae replaced with the consecutive letters from the input, shifted to uppercase.
║Example 1: sicp -> Sorced Indendation Cf Pode
║Example 2: SUSS -> Sorced Undendation Sf Sode

Your entry has to be a
source code
of a complete program
that takes the input on stdin and outputs the string to stdout. Shortest program wins.

Name: Anonymous 2017-10-21 10:55

getmetatable('').__index = function(str,i) return string.sub(str,i,i) end
four_letters =
_err = #four_letters == 4 or error("wrong length")
four_letters = string.upper(four_letters)
io.write(table.concat({four_letters[1], "orced ", four_letters[2], "dentation ", four_letters[3], "f ", four_letters[4], "ode"}))

Name: Anonymous 2017-10-21 11:21

Name: Anonymous 2017-10-21 13:52

[a,b,c,d] = (prompt()||(' ')).slice(0,4).toUpperCase().split('');
`${a}orced ${b}ndendation ${c}f ${d}ode`

Name: Anonymous 2017-10-21 14:26

'%sorced %sndendation %sf %sode'%gets.chomp[0..3].upcase.chars

Name: Anonymous 2017-10-21 15:23

Forced Undendation Cf Kode

Name: Cudder !cXCudderUE 2017-10-21 17:13

main(){char a[5];gets(a);printf("%corced %cndentation %cf %code",*a&223,a[1]&223,a[2]&223,a[3]&223);}

Name: Anonymous 2017-10-21 17:23


orced ndentation f ode
fukken epic man

Name: Anonymous 2017-10-21 18:07

Input: A four-letter ASCII string

Name: Anonymous 2017-10-21 18:12

u srs?
well if you're gonna be like that, then this is an ascii "letter" too: ë
does it work? nope

Name: Anonymous 2017-10-21 19:27

u mena ``Windows-1251''?

Name: Anonymous 2017-10-21 19:36

no I mena high ASCII

Name: Anonymous 2017-10-21 19:43


Name: Anonymous 2017-10-21 19:54

People don't really do error handling or input validation in code golf-tier challenges.

Name: Anonymous 2017-10-21 20:25

There are a trillion different EASCII variants
ASCII is 7 bit

Name: Anonymous 2017-10-22 1:13


Name: Anonymous 2017-10-22 5:37

4 0 DO
EMIT ." orced "
EMIT ." ndentation "
EMIT ." f "
EMIT ." ode" ;

Name: Anonymous 2017-10-22 10:15

using System;public class P
{static void Main()
{var l=Console.ReadLine().ToUpper();Console.Write($"{l[0]}orced {l[1]}ndendation {l[2]}f {l[3]}ode");}}

Name: Anonymous 2017-10-22 16:28

printf"%sorced %sndentation %sf %sode",split//,uc<>

Name: Anonymous 2017-10-22 21:48

echo('${1}orced ${2}ndentation ${3}f ${4}ode', read().toupper().split(''))

Will inling the input work like this? I cannot check now.

Name: Anonymous 2017-10-23 6:51


Name: Anonymous 2017-10-23 7:34

FIOC challenge in FIOC3:

x=tuple(input().upper());print("%sorced %sndentation %sf %sode" % x)

Name: Anonymous 2017-10-23 7:41

a bit shorter version:
print("%sorced %sndentation %sf %sode" % tuple(input().upper()))

Name: Anonymous 2017-10-23 7:46

spaces are actually unnecessary for format string so there's this improvement but I don't think I can go any further than 62 bytes:

print("%sorced %sndentation %sf %sode"%tuple(input().upper()))

Name: Anonymous 2017-10-23 8:40

One way I see to reduce the bytesize is compressing the string to output. Can we use some kind of a custom encoding? It's terribly wasteful in raw ASCII.

Name: Anonymous 2017-10-23 8:52

write it directly in machine code?

Name: Anonymous 2017-10-23 9:16

Aorced Nndentation Uf Sode

Name: Cudder !cXCudderUE 2017-10-23 10:57

char main[]="エ?1ロケ コ Rヘ!_セ&・ャ$゚超ヘ!・ュ超 ヘ!粮テ.5ADorced $ndentation $f $ode$";
Source is not much shorter, but binary is only 72B.

Name: Anonymous 2017-10-23 12:01

Segmentation fault (core dumped)
something's wrong. W^X I guess? what do you use to compile it?

Name: Anonymous 2017-10-23 14:14

destructuring bind and type conversions are just too verbose in common lisp

(destructuring-bind(a b c d)(coerce(string-upcase(read))'list)(format nil"~Aorced ~Andentation ~Af ~Aode"a b c d))

Name: Anonymous 2017-10-23 14:29

small improvement: t instead of nil

(destructuring-bind(a b c d)(coerce(string-upcase(read))'list)(format t"~Aorced ~Andentation ~Af ~Aode"a b c d))

Name: Anonymous 2017-10-23 15:54

looking for other lisps in which it could be more terse. clojure's deconstructing bind available in a normal let expression and working natively on strings sounds like a good start but the uppercasing ruins it (although it still beats CL):
(let[[f i o c](clojure.string/upper-case(read-line))](print(format"%sorced %sndentation %sf %sode"f i o c)))

I'm gonna fuck around with scheme dialects now

Name: Anonymous 2017-10-23 16:45

so for this dubspost I went with Racket, which I think is the most usable sort-of- Scheme.

the natural way of destructuring in racket would be through match-let:
(match-let([(list f i o c)(string->list(string-upcase(read-line)))])(printf"~aorced ~andentation ~af ~aode"f i o c))

...but abusing match gives us better results. would be better than Clojure if you could natively destructure strings (well, maybe you can; I think it's possible but I may be wrong).

(match(string->list(string-upcase(read-line)))[(list f i o c)(printf"~aorced ~andentation ~af ~aode"f i o c)])

Name: Anonymous 2017-10-23 16:48

(string-replace >>33 "possible" "impossible")

Name: Anonymous 2017-10-23 16:55

Couldn't resist, huh?

Name: Cudder !cXCudderUE 2017-10-24 0:45

It's a DOS flat executable (.com)

Name: Anonymous 2017-10-24 6:16

nice. will need to try that in DOSbox or FreeDOS. what compilers handle that format? I guess they shouldn't be hard to find as it's basically just machine code, right?

Name: Anonymous 2017-10-24 6:45

actually, converting string to list makes it possible to use apply. this makes the CL version much shorter:
(apply #'format t"~aorced ~andentation ~af ~aode"(coerce(string-upcase(read))'list))

racket version also gets better, but not that much better:
(apply format "~aorced ~andentation ~af ~aode" (string->list(string-upcase(read-line))))

Name: Anonymous 2017-10-24 11:44


Why Lisp's function names are so verbose?

Name: Anonymous 2017-10-24 12:19

this isn't a rule. Lisp function names can be either verbose like string->list or obtuse like mapcan or rplaca.

Name: Anonymous 2017-10-24 12:21

Why can't you have short expressive names, like subst or upcase?

Name: Anonymous 2017-10-24 13:55

I dunno, I didn't design any of those languages. I just wrote code in them. if I had to guess, a lot of the verbosity would be because originally lisps didn't have polymorphism or multimethods so if you wanted different beavior dependent on type, you needed multiple function names (which explains e.g. string-upcase and char-upcase. obtuse names like rplaca on the other hand were pretty common in older languages (before the ideas like literate programming became more mainstream): just look at C standard library having function names like atoi, fprintf or ldexp. if you didn't already know what they do, you'd have a hard time figuring it out based on those names.

Name: Anonymous 2017-10-29 10:52

Guys, there's 3 days left, you still have chance to compete.

Name: Anonymous 2017-10-29 11:25

Everyone already did.

Name: Anonymous 2017-10-29 15:01

isn't standard input and the browser console isn't standard output.

process.stdin.on('data', s=>{[a,b,c,d]=(''+s).toUpperCase().split('');console.log(`${a}orced ${b}ndendation ${c}f ${d}ode`)})

Name: Anonymous 2017-10-29 19:01

Which entry is mine?
Which is yours?
Which is The Sussman's?

Name: Anonymous 2017-11-02 3:16

Sorced Hndentation If Tode

Name: Christopher 2017-11-03 22:17

🍫 ⋆ 🍪  🎀  𝒞𝐻𝒜𝐿𝐿𝐸𝒩𝒢𝐸 𝐹𝐼𝒩𝐼𝒮𝐻𝐸𝒟  🎀  🍪 ⋆ 🍫

WINNER: >>19-kun


Name: Anonymous 2017-11-03 22:23

What language is this even?

Name: Anonymous 2017-11-04 1:08


Name: Anonymous 2017-11-07 0:41

ack off

Name: Anonymous 2017-11-08 8:11

nice. hope that /prog/ challenge tradition returns!

Name: Anonymous 2017-11-08 15:36


Name: Anonymous 2017-11-08 16:30

I saw the // and immediately thought ``comment.'' That must have been why.

Name: Anonymous 2017-11-08 16:46


Name: Christopher 2017-11-08 22:04

Me too my friend! Feel free to post some, I will do it when I have a surge of creativity

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