14
\$\begingroup\$

Most Unicode characters have full names, for example is "RIGHT DOUBLE QUOTATION MARK". You can find a useful reference here, just type in the character you want to find the full name of and look in the DESCRIPTION column.

Your challenge is to write a program or function that outputs itself as a string of these. You can output as an array, or space/newline separated.

Scoring

This challenge is scored in characters instead of bytes - Least characters wins!

You can only use characters with descriptions other than U+(Whatever), so and similar are banned.

External resources are allowed, but those without are generally more interesting.

\$\endgroup\$
9
  • 1
    \$\begingroup\$ The website you linked shows kDefinition for CJK characters instead of their name (do they have a name?) example: fileformat.info/info/unicode/char/4e01/index.htm \$\endgroup\$
    – tsh
    Jun 28 at 9:42
  • 1
    \$\begingroup\$ @tsh I guess just go with what it says, unless you have a better idea of what it means than the website. \$\endgroup\$
    – emanresu A
    Jun 28 at 9:53
  • 1
    \$\begingroup\$ To my understanding, meaning is not the same thing as name. \$\endgroup\$
    – tsh
    Jun 28 at 10:01
  • 1
    \$\begingroup\$ Can you please update the challenge to state that external resources are permitted, as you confirmed to Recursive Co. in chat. \$\endgroup\$
    – Shaggy
    Jun 28 at 10:42
  • 3
    \$\begingroup\$ @DarrelHoffman Standard loopholes apply unless specified otherwise - that's why it's called standard loopholes. \$\endgroup\$
    – emanresu A
    Jun 29 at 4:25
14
\$\begingroup\$

Raku, 37 characters

<print "<$_>~~.EVAL".uninames>~~.EVAL

Try it online!

Variation of the standard Raku quines using print to avoid the trailing newline and .uninames to convert to a list of character names.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Ummmmm...... Points for cleverness, but I'm still looking forward to a builtin-less answer. \$\endgroup\$
    – emanresu A
    Jun 28 at 8:42
  • 5
    \$\begingroup\$ You have really done a PhD on quines...., 3 mins and you attack \$\endgroup\$
    – wasif
    Jun 28 at 8:53
11
\$\begingroup\$

JavaScript, 440 bytes

f=a=>[..."f="+f].map(n=>({"(":(l="LEFT ")+(p="PARENTHESIS"),")":(r="RIGHT ")+p,"{":l+(c="CURLY"+(b=" BRACKET")),"}":r+c,"[":l+(q="SQUARE"+b),"]":r+q,"=":"EQUALS"+(s=" SIGN"),">":"GREATER-THAN"+s,"+":"PLUS"+s,"\\":"REVERSE SOLIDUS","\"":"QUOTATION MARK","&":"AMPERSAND",".":"FULL STOP",",":"COMMA",":":"COLON"," ":"SPACE","-":"HYPHEN-MINUS","|":"VERTICAL LINE"}[n]||"LATIN "+(n>{}&&"SMALL"||"CAPITAL")+" LETTER "+n.toUpperCase())).join("\n")

Try it online!

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Don't you mean .join`\n`? (Where \n is a literal newline) \$\endgroup\$
    – emanresu A
    Jun 28 at 10:35
  • 2
    \$\begingroup\$ @Ausername it would inflate his/her bytecount as he/she would need to add an extra key/value pair for the backtick. \$\endgroup\$
    – user100690
    Jun 28 at 11:03
  • 1
    \$\begingroup\$ (n>{}&&"SMAL"||"CAPITA")+"L LETTER " saves a byte and you can get rid of thejoin as returning an array is allowed. \$\endgroup\$
    – Shaggy
    Jun 28 at 12:00
  • 1
    \$\begingroup\$ Does this work for a 31 byte saving? \$\endgroup\$
    – user100690
    Jun 28 at 12:37
  • 1
    \$\begingroup\$ -3 more bytes following on from @RecursiveCo's suggestions. \$\endgroup\$
    – Shaggy
    Jun 29 at 9:17
11
\$\begingroup\$

Haskell, 642 bytes

f" "="SPACE";f"\""="QUOTATION MARK";f"."="FULL STOP";f";"="SEMICOLON";f"<"="LESS-THAN SIGN";f"="="EQUALS SIGN";f">"="GREATER-THAN SIGN";f"\\"="REVERSE SOLIDUS";f"-"="HYPHEN-MINUS";f x="LATIN "<>if x>"Z"then"SMALL LETTER "<>x else"CAPITAL LETTER "<>x;u=putStrLn.f.pure;s=id<>show;n=mapM u.s;main=n"f\" \"=\"SPACE\";f\"\\\"\"=\"QUOTATION MARK\";f\".\"=\"FULL STOP\";f\";\"=\"SEMICOLON\";f\"<\"=\"LESS-THAN SIGN\";f\"=\"=\"EQUALS SIGN\";f\">\"=\"GREATER-THAN SIGN\";f\"\\\\\"=\"REVERSE SOLIDUS\";f\"-\"=\"HYPHEN-MINUS\";f x=\"LATIN \"<>if x>\"Z\"then\"SMALL LETTER \"<>x else\"CAPITAL LETTER \"<>x;u=putStrLn.f.pure;s=id<>show;n=mapM u.s;main=n"

Try it online!

\$\endgroup\$
4
7
\$\begingroup\$

Python 2, 68 characters

Based on this quine.

s="from unicodedata import*;print map(name,u's=%r;exec s'%s)";exec s

Try it online!

\$\endgroup\$
5
\$\begingroup\$

JavaScript (browser), 365 characters

(f=async _=>{i='';for(e of `(f=${f})()`)i+=await fetch(`https://unicode-search.net/unicode-namesearch.pl?term=${e}&.submit=Search`).then(r=>r.text()).then(s=>(/[a-zA-Z]/.test(e)?`LATIN ${/[a-z]/.test(e)?'SMAL':'CAPITA'}L LETTER `+e.toUpperCase():s.substr(S=s.search(/(?<=class\="name" (colspan\="."|lang\="en")>)/),s.slice(S).search(`<\/`)))+' ');console.log(i)})()

This took a really long time to write. Outputs

LEFT PARENTHESIS LATIN SMALL LETTER F EQUALS SIGN LATIN SMALL LETTER A LATIN SMALL LETTER S LATIN SMALL LETTER Y LATIN SMALL LETTER N LATIN SMALL LETTER C SPACE LOW LINE EQUALS SIGN GREATER-THAN SIGN LEFT CURLY BRACKET LATIN SMALL LETTER I EQUALS SIGN APOSTROPHE APOSTROPHE  LATIN SMALL LETTER F LATIN SMALL LETTER O LATIN SMALL LETTER R LEFT PARENTHESIS LATIN SMALL LETTER E SPACE LATIN SMALL LETTER O LATIN SMALL LETTER F SPACE GRAVE ACCENT LEFT PARENTHESIS LATIN SMALL LETTER F EQUALS SIGN DOLLAR SIGN LEFT CURLY BRACKET LATIN SMALL LETTER F RIGHT CURLY BRACKET RIGHT PARENTHESIS LEFT PARENTHESIS RIGHT PARENTHESIS GRAVE ACCENT RIGHT PARENTHESIS LATIN SMALL LETTER I SPACE EQUALS SIGN LATIN SMALL LETTER A LATIN SMALL LETTER W LATIN SMALL LETTER A LATIN SMALL LETTER I LATIN SMALL LETTER T SPACE LATIN SMALL LETTER F LATIN SMALL LETTER E LATIN SMALL LETTER T LATIN SMALL LETTER C LATIN SMALL LETTER H LEFT PARENTHESIS GRAVE ACCENT LATIN SMALL LETTER H LATIN SMALL LETTER T LATIN SMALL LETTER T LATIN SMALL LETTER P LATIN SMALL LETTER S COLON SOLIDUS SOLIDUS LATIN SMALL LETTER U LATIN SMALL LETTER N LATIN SMALL LETTER I LATIN SMALL LETTER C LATIN SMALL LETTER O LATIN SMALL LETTER D LATIN SMALL LETTER E HYPHEN-MINUS LATIN SMALL LETTER S LATIN SMALL LETTER E LATIN SMALL LETTER A LATIN SMALL LETTER R LATIN SMALL LETTER C LATIN SMALL LETTER H FULL STOP LATIN SMALL LETTER N LATIN SMALL LETTER E LATIN SMALL LETTER T SOLIDUS LATIN SMALL LETTER U LATIN SMALL LETTER N LATIN SMALL LETTER I LATIN SMALL LETTER C LATIN SMALL LETTER O LATIN SMALL LETTER D LATIN SMALL LETTER E HYPHEN-MINUS LATIN SMALL LETTER N LATIN SMALL LETTER A LATIN SMALL LETTER M LATIN SMALL LETTER E LATIN SMALL LETTER S LATIN SMALL LETTER E LATIN SMALL LETTER A LATIN SMALL LETTER R LATIN SMALL LETTER C LATIN SMALL LETTER H FULL STOP LATIN SMALL LETTER P LATIN SMALL LETTER L QUESTION MARK LATIN SMALL LETTER T LATIN SMALL LETTER E LATIN SMALL LETTER R LATIN SMALL LETTER M EQUALS SIGN DOLLAR SIGN LEFT CURLY BRACKET LATIN SMALL LETTER E RIGHT CURLY BRACKET  FULL STOP LATIN SMALL LETTER S LATIN SMALL LETTER U LATIN SMALL LETTER B LATIN SMALL LETTER M LATIN SMALL LETTER I LATIN SMALL LETTER T EQUALS SIGN LATIN CAPITAL LETTER S LATIN SMALL LETTER E LATIN SMALL LETTER A LATIN SMALL LETTER R LATIN SMALL LETTER C LATIN SMALL LETTER H GRAVE ACCENT RIGHT PARENTHESIS FULL STOP LATIN SMALL LETTER T LATIN SMALL LETTER H LATIN SMALL LETTER E LATIN SMALL LETTER N LEFT PARENTHESIS LATIN SMALL LETTER R EQUALS SIGN GREATER-THAN SIGN LATIN SMALL LETTER R FULL STOP LATIN SMALL LETTER T LATIN SMALL LETTER E LATIN SMALL LETTER X LATIN SMALL LETTER T LEFT PARENTHESIS RIGHT PARENTHESIS RIGHT PARENTHESIS FULL STOP LATIN SMALL LETTER T LATIN SMALL LETTER H LATIN SMALL LETTER E LATIN SMALL LETTER N LEFT PARENTHESIS LATIN SMALL LETTER S EQUALS SIGN GREATER-THAN SIGN LEFT PARENTHESIS SOLIDUS LEFT SQUARE BRACKET LATIN SMALL LETTER A HYPHEN-MINUS LATIN SMALL LETTER Z LATIN CAPITAL LETTER A HYPHEN-MINUS LATIN CAPITAL LETTER Z RIGHT SQUARE BRACKET SOLIDUS FULL STOP LATIN SMALL LETTER T LATIN SMALL LETTER E LATIN SMALL LETTER S LATIN SMALL LETTER T LEFT PARENTHESIS LATIN SMALL LETTER E RIGHT PARENTHESIS QUESTION MARK GRAVE ACCENT LATIN CAPITAL LETTER L LATIN CAPITAL LETTER A LATIN CAPITAL LETTER T LATIN CAPITAL LETTER I LATIN CAPITAL LETTER N SPACE DOLLAR SIGN LEFT CURLY BRACKET SOLIDUS LEFT SQUARE BRACKET LATIN SMALL LETTER A HYPHEN-MINUS LATIN SMALL LETTER Z RIGHT SQUARE BRACKET SOLIDUS FULL STOP LATIN SMALL LETTER T LATIN SMALL LETTER E LATIN SMALL LETTER S LATIN SMALL LETTER T LEFT PARENTHESIS LATIN SMALL LETTER E RIGHT PARENTHESIS QUESTION MARK APOSTROPHE LATIN CAPITAL LETTER S LATIN CAPITAL LETTER M LATIN CAPITAL LETTER A LATIN CAPITAL LETTER L APOSTROPHE COLON APOSTROPHE LATIN CAPITAL LETTER C LATIN CAPITAL LETTER A LATIN CAPITAL LETTER P LATIN CAPITAL LETTER I LATIN CAPITAL LETTER T LATIN CAPITAL LETTER A APOSTROPHE RIGHT CURLY BRACKET LATIN CAPITAL LETTER L SPACE LATIN CAPITAL LETTER L LATIN CAPITAL LETTER E LATIN CAPITAL LETTER T LATIN CAPITAL LETTER T LATIN CAPITAL LETTER E LATIN CAPITAL LETTER R GRAVE ACCENT SPACE LATIN SMALL LETTER E FULL STOP LATIN SMALL LETTER T LATIN SMALL LETTER O LATIN CAPITAL LETTER U LATIN SMALL LETTER P LATIN SMALL LETTER P LATIN SMALL LETTER E LATIN SMALL LETTER R LATIN CAPITAL LETTER C LATIN SMALL LETTER A LATIN SMALL LETTER S LATIN SMALL LETTER E LEFT PARENTHESIS RIGHT PARENTHESIS COLON LATIN SMALL LETTER S FULL STOP LATIN SMALL LETTER S LATIN SMALL LETTER U LATIN SMALL LETTER B LATIN SMALL LETTER S LATIN SMALL LETTER T LATIN SMALL LETTER R LEFT PARENTHESIS LATIN CAPITAL LETTER S EQUALS SIGN LATIN SMALL LETTER S FULL STOP LATIN SMALL LETTER S LATIN SMALL LETTER E LATIN SMALL LETTER A LATIN SMALL LETTER R LATIN SMALL LETTER C LATIN SMALL LETTER H LEFT PARENTHESIS SOLIDUS LEFT PARENTHESIS QUESTION MARK LESS-THAN SIGN EQUALS SIGN LATIN SMALL LETTER C LATIN SMALL LETTER L LATIN SMALL LETTER A LATIN SMALL LETTER S LATIN SMALL LETTER S REVERSE SOLIDUS EQUALS SIGN QUOTATION MARK LATIN SMALL LETTER N LATIN SMALL LETTER A LATIN SMALL LETTER M LATIN SMALL LETTER E QUOTATION MARK SPACE LEFT PARENTHESIS LATIN SMALL LETTER C LATIN SMALL LETTER O LATIN SMALL LETTER L LATIN SMALL LETTER S LATIN SMALL LETTER P LATIN SMALL LETTER A LATIN SMALL LETTER N REVERSE SOLIDUS EQUALS SIGN QUOTATION MARK FULL STOP QUOTATION MARK VERTICAL LINE LATIN SMALL LETTER L LATIN SMALL LETTER A LATIN SMALL LETTER N LATIN SMALL LETTER G REVERSE SOLIDUS EQUALS SIGN QUOTATION MARK LATIN SMALL LETTER E LATIN SMALL LETTER N QUOTATION MARK RIGHT PARENTHESIS GREATER-THAN SIGN RIGHT PARENTHESIS SOLIDUS RIGHT PARENTHESIS COMMA LATIN SMALL LETTER S FULL STOP LATIN SMALL LETTER S LATIN SMALL LETTER L LATIN SMALL LETTER I LATIN SMALL LETTER C LATIN SMALL LETTER E LEFT PARENTHESIS LATIN CAPITAL LETTER S RIGHT PARENTHESIS FULL STOP LATIN SMALL LETTER S LATIN SMALL LETTER E LATIN SMALL LETTER A LATIN SMALL LETTER R LATIN SMALL LETTER C LATIN SMALL LETTER H LEFT PARENTHESIS GRAVE ACCENT LESS-THAN SIGN REVERSE SOLIDUS SOLIDUS GRAVE ACCENT RIGHT PARENTHESIS RIGHT PARENTHESIS RIGHT PARENTHESIS SPACE APOSTROPHE SPACE APOSTROPHE RIGHT PARENTHESIS  LATIN SMALL LETTER C LATIN SMALL LETTER O LATIN SMALL LETTER N LATIN SMALL LETTER S LATIN SMALL LETTER O LATIN SMALL LETTER L LATIN SMALL LETTER E FULL STOP LATIN SMALL LETTER L LATIN SMALL LETTER O LATIN SMALL LETTER G LEFT PARENTHESIS LATIN SMALL LETTER I RIGHT PARENTHESIS RIGHT CURLY BRACKET RIGHT PARENTHESIS LEFT PARENTHESIS RIGHT PARENTHESIS

using unicode-search.net.

-7 chars to fix small bug. No, that's not a typo, I actually saved characters fixing a bug which made all small letters "CAPITAL".

\$\endgroup\$
4
  • 1
    \$\begingroup\$ @UnrelatedString I asked A username in chat and they said it was allowed \$\endgroup\$
    – user100690
    Jun 28 at 9:49
  • 1
    \$\begingroup\$ .search(`<\/`) -> .search`<\/` saves 2 bytes i think \$\endgroup\$
    – user100752
    Jun 28 at 10:51
  • 1
    \$\begingroup\$ It doesn't looks like you need the &.submit=Search part and converting the characters to hexadecimal codepoints (e.codePointAt().toString(16))) when passing them to that URL should get you around the need to handle <control>s. \$\endgroup\$
    – Shaggy
    Jun 28 at 11:28
  • 2
    \$\begingroup\$ I'm deleting my comment stating "I believe using online resources like this is forbidden by default, although I suppose it's not entirely clear. ", which I note is worryingly the only comment here upvoted by anyone other than myself. The challenge has long since been updated to clear up that this is permitted. Please stop downvoting, people--or if not, have the courtesy to say why. \$\endgroup\$ Jun 29 at 11:22
4
\$\begingroup\$

Jelly, 66 64 bytes

“__import__('unicodedata').name(*'''“ ''')“jⱮṾ;ṪƊŒV€Y”jⱮṾ;ṪƊŒV€Y

Try it online!

-2 bytes by splicing and splatting instead of using string

This still feels... easily outdone. Probably using v.

“...“...“jⱮṾ;ṪƊŒV€Y”              Operate on this list of three strings.
                      Ṿ           Get its string representation
                       ;          and concatenate
                        Ṫ         and pop its last element;
                     Ɱ   Ɗ        for each character of that result
                    j             join the remaining two elements on it.
                          ŒV€     Evaluate each as Python,
                             Y    and join the values on newlines.

In order to place a literal single quote inside the Python code and use it as such, we can't use '\“' because most other characters will either result in an unwanted incorrect escape sequence or an actual backslash and a TypeError, we can't use "“" because now we just have the same problem with double quotes, and we can't use '''“''' because ''''''' parses as '''''' ' resulting in a SyntaxError. '''“ '''[0] only breaks even with the previous version, but fortunately unicodedata.name can take an optional second argument--a default for if the character given does not have a name--so we can use the splat operator * to send the unwanted space there for two less bytes.

\$\endgroup\$
4
\$\begingroup\$

JavaScript, 144 102 bytes

Needs to be run in the browser console from this page as permitted here. Returns an array of promises containing the character names as permitted here. +12 bytes to fix a bug with spaces :\

f=_=>[...`f=`+f].map(async c=>(await(await fetch(`?a=`+(c==` `?20:c))).text()).match(/me'>(.+?)</)[1])
\$\endgroup\$
10
  • 4
    \$\begingroup\$ @Downvoter, a comment would be appreciated. Given that you also (apparently) downvoted Recusrive's solution, I'm guessing you're taking issue with that fact that we're fetching the data from an external resource, in which case your issue should be with the challenge which explicitly allows that, rather than any individual solutions making use of that allowance. Also, fetching them from an external resource is really not that much different from importing them from a built-in library. \$\endgroup\$
    – Shaggy
    Jun 29 at 9:12
  • 1
    \$\begingroup\$ My answer has just received another downvote. While @user253751 is correct in saying that "those without are generally more interesting", it doesn't make our (mine and Shaggy's) solutions any less valid. IMO only invalid answers should be downvoted. Seeing as a few others (Jelly, Raku) were downvoted, I suspect that the downvoter(s) are downvoting solutions that are not building the unicode names from scratch (tsh's solution, for instance, has not been downvoted). However, ovs's answer, which uses a library (there isn't even any effort to extract text from a source) has not been downvoted. \$\endgroup\$
    – user100690
    Jun 29 at 9:49
  • 2
    \$\begingroup\$ Another 2 -1s for me, @RecursiveCo. :\ Very frustrating after the time & effort we both put into coming up with and golfing our solutions. \$\endgroup\$
    – Shaggy
    Jun 29 at 10:35
  • 1
    \$\begingroup\$ @user253751, see the second consensus I linked to in my solution. And we haven't counted flags for a long time. \$\endgroup\$
    – Shaggy
    Jun 29 at 10:43
  • 4
    \$\begingroup\$ So many downvotes... I don't see the difference between using an external resource and having a built-in (just like my answer in Java). If people aren't happy with the shortcuts, they should downvote the meta question, not this answer. \$\endgroup\$ Jun 29 at 10:43
3
\$\begingroup\$

Perl 5, 63 bytes

$_=q(say charnames::viacode(ord)for"\$_=q($_);eval"=~/./g);eval

Try it online!

\$\endgroup\$
3
\$\begingroup\$

Java (JDK), 156 bytes

v->{var s="v->{var s=%c%s%1$c;return s.format(s,34,s).chars().mapToObj(Character::getName);}";return s.format(s,34,s).chars().mapToObj(Character::getName);}

Try it online!

Takes a null input and returns a Stream<String>.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.