• Re: Is it possible to NOT use identifiers named only with _'s?

    From Kpop 2GM@jason.cy.kwan@gmail.com to comp.lang.awk on Mon Jul 31 21:34:10 2023
    From Newsgroup: comp.lang.awk

    On Wednesday, March 8, 2023 at 9:09:43 PM UTC-5, Janis Papanagnou wrote:
    On 09.03.2023 01:40, J Naman wrote:
    _________ = ___(____[________])- (__+___)/(______^_____ ); # Really?
    Where is that from?

    (Kpop had some fun with obfuscated code in the past.)
    Posts to comp.lang.awk with identifiers named only with _'s are
    nearly impossible to read, especially on monitors that display
    multiple _'s as a continuous line (versus small breaks seen in dashes -----).
    (I'd think it's not the monitor that does the character rendering.)
    Thank you for making readable code.
    Either that, or help yourself with a quick and _dirty_(!) hack...

    awk 'BEGIN { split("abcdefghijklmnopqrstuvwxyz",_,"") }
    { while(match($0,/_+/)) sub(/_+/,_[RLENGTH]) } ; 1'

    produces (with your line above)

    i = c(d[h])- (b+c)/(f^e );

    HTH.

    Janis :-)
    believe it or not, I actually directly write code in those underscores even for myself.
    like this one - a fully posix-compliant function for ANY awk variant to print out all 1,114,112 Unicode code-points to encoding specs of UTF-8 (default), UTF 16 LE/BE (including surrogates), and UTF 32 LE/BE, or any single arbitrary byte (with the sole exception being nawk's inability to properly handle the \0 null byte),
    all while needing a total of just 4 local variables (that's inclusive of the 2 variables for accepting input),
    performs data cleansing and input range clamping,
    has ZERO dependency on hard-coded magic numbers for cutoffs, scalars, offsets etc (since they're all generated on the fly as part of the input cleansing process setup),
    has zero external function calls other than the built-in functions of int( ) and sprintf( ),
    is entirely loop-free and recursion free,
    can circumvent certain awk variant restrictions (like gawk refusing to print anything correct for negative inputs to "%c"),
    and can output in UTF16 or UTF32 even when locale is in ASCII mode. function.chrUC8(__, _, ___, ____).{
    ....#
    ....#.__|.Unicode.code.point
    ....#.....outside.U+0000.-.U+10FFFF:
    ....#.....-->.UTF-8/16/32.clamps.to
    ....#............8/16/32-bits.respectively ....#.....-->.U8.mode.also.clamps.U16.surrogate.ranges
    ....#
    ....#.._|.[1].missing,.empty.string.input,.or
    ....#.........numeric.zero.:.U8
    ....#.....[2].+/-.16/32.:
    ....#............-16....:.UTF-16.LE ....#...............+32.:.UTF-32.BE.|._+_.optional: ....#.....[3].anything.else.: ....#.........direct.pass-through.to.built-in.encoder; ....#.........inputs.not.clamped.or.pre-sanitized
    ....#
    ....#...|--->.UC.codepoint.byte-encoded.in ....#............requested.encoding.format,.1-4.bytes
    ....return.\
    ....((____=___=_+=((_~!!_)<(""<_))*!+_)*_\ .....................).>=.(_+=_+=_^=_<_)^_\
    ....?.(___*___.==._^_.\
    ........?.(.((__.=.(-(__=int(__)).<=.+__.&& ..........__.<.((_+_)^_.*.(_*_.+._^_))).?.\ ..........__.:.(__.%.(___.=_^(_+_))+___).%.___).\ ........*.(____.=._*_.==.-____)^!_\ ........*.(___.=._^_*(_+(--_+_)^_))^!_)<--_^_^_^_++.\ ........?.sprintf("%c%c",.int((__=____*(_^=++_).\ ............?.__%_*_+int(__/_).:.__)/_)+___,__%_+___).\ ........:.sprintf("%c%c%c%c",.int((__.=.____*(____=.\ ............int((__-=++_^(_+_))/_^_/_)-_^_*_+___).*.\ ...............................(__.=.__%(_*(_^=_))+___).\ ............?._*(____%_*_+int(____/_)).*_.+.__%_*_.+.int(__/_)\ ..................:.__+_*____*_)./_./_./_).+.___, ............int(__/_/_).%_+___,int(+__/_).%_+___,__%_+___).\ .....).:.(+___.<.-___).==.(___.=.(--_+_)^_.*.(_.^=.++_).)^!_.\ ........?.sprintf("%c%c%c%c",.(__.=.int(__).%.(_*_*_*_))%_+___, ............int(__/_).%_+___,.(__.=.int(__/_/_))%_.+.___,.int(__/_)+___)\ ........:.sprintf("%c%c%c%c",.int((__.%=._*_*_*_)./_/_/_).+.___, ............int(__/_/_)%_+___,int(__/_).%_.+.___,.__%_.+.___).\ .................................).\ .................................:..+___..|| ..........(((__=+__)+__)<_^_.&&.-__<=+__).|| ......((___=(--_+_)^_*++_^_)<=__.&&.__<(_^_*(_+_)+___)).|| ..................................+__<-__.|| ..............................((_+_)^_*(_*_+_^_))<=__\ ........?.sprintf("%c",+___<_?__:.(__%(_^=_)+_)%_+___)\ ....:.(__+__)<(_+_)^_..................................\ ........?.sprintf("%c%c",.(___.+=.(_*=_*_)+_).+_+.int(__/_),.__%_+___).\ ....:.__<_^(_+_)....................................................\ ........?.sprintf("%c%c%c",._*(_+_).+.(___.+=.(_*=_*_)+_).+_+.int(__/_/_), .....................................int(__/_)%_.+.___,.__%_.+.___).\ ........:.sprintf("%c%c%c%c",._*-_+.(___.+=.(_*=_*_)+_).+_+_+.int(__/_/_/_), .................int(__/_/_)%_+___,.int(__/_)%_.+.___,__%_+___)
    }
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.lang.awk on Tue Aug 1 17:22:35 2023
    From Newsgroup: comp.lang.awk

    On 01.08.2023 06:34, Kpop 2GM wrote:
    On 09.03.2023 01:40, J Naman wrote:
    _________ = ___(____[________])- (__+___)/(______^_____ ); # Really?

    believe it or not, I actually directly write code in those underscores even for myself.

    I wonder why.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114