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

    From J Naman@21:1/5 to All on Wed Mar 8 16:40:52 2023
    _________ = ___(____[________])- (__+___)/(______^_____ ); # Really?
    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 -----).
    Thank you for making readable code.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to J Naman on Thu Mar 9 03:09:40 2023
    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 :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to [email protected] on Thu Mar 9 05:57:57 2023
    In article <[email protected]>,
    J Naman <[email protected]> wrote:
    _________ = ___(____[________])- (__+___)/(______^_____ ); # Really?
    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 -----).
    Thank you for making readable code.

    That's the whole point of those posts.
    That code is not intended to be readable.

    I think that the lunatic who posts those can be safely ignored.

    --
    The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL:
    http://user.xmission.com/~gazelle/Sigs/RightWingMedia

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From J Naman@21:1/5 to Kenny McCormack on Thu Mar 9 16:34:08 2023
    On Thursday, 9 March 2023 at 00:58:01 UTC-5, Kenny McCormack wrote:
    In article <[email protected]>,
    J Naman <[email protected]> wrote:
    _________ = ___(____[________])- (__+___)/(______^_____ ); # Really?
    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 -----).
    Thank you for making readable code.
    That's the whole point of those posts.
    That code is not intended to be readable.

    I think that the lunatic who posts those can be safely ignored.

    --
    The randomly chosen signature file that would have appeared here is more than 4
    lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL:
    http://user.xmission.com/~gazelle/Sigs/RightWingMedia

    Janis: What a lovely quick & dirty! I'm putting it in my library under loony_tunes_translator.awk (thanks Kenny!)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Kenny McCormack on Sat Mar 11 21:10:45 2023
    On 2023-03-09, Kenny McCormack <[email protected]> wrote:
    In article <[email protected]>,
    J Naman <[email protected]> wrote:
    _________ = ___(____[________])- (__+___)/(______^_____ ); # Really? >>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 -----).
    Thank you for making readable code.

    That's the whole point of those posts.
    That code is not intended to be readable.

    As far as the underscores go, it's easy enough to decode.

    $ txr demangle.tl
    function compare(__, _, ___) {
    …. return +__==+___ \
    ….…. ? _ ~ "[^!]=" \
    ….…. : (_ ~ "[!=].|.>" || +__<+___)==(_<"=")
    }
    [Ctrl-D][Enter]
    function compare(b, a, c) {
    …. return +b==+c \
    ….…. ? a ~ "[^!]=" \
    ….…. : (a ~ "[!=].|.>" || +b<+c)==(a<"=")
    }

    $ cat demangle.tl
    (let ((letters (list-seq "a".."z"))) ;; list strings "a" to "z"
    (flow
    (get-string) ;; get stdin as one big string
    (tok #/_+/ t) ;; tokenize
    (mapcar [iffi (op starts-with "_") ;; map __ tokens to letters
    [chain len pred letters]])
    (apply join) ;; reconstitute
    (pprint)))

    Tokens are defined a sequences of one or more underscores, or else
    sequences of other identifiers.

    We replace an underscore token by taking the predecessor of its length,
    and indexing into the list of "a" to "z" strings: _ maps to a, __ to b
    and so on.

    A list can be used as a function, which is how letters works in the
    expression [chain len pred letters]. When a list is used as a
    one-argument function, the argument is a zero-based integer index which retrieves an element from the list.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Kaz Kylheku on Sun Mar 12 02:12:06 2023
    On 2023-03-11, Kaz Kylheku <[email protected]> wrote:
    $ cat demangle.tl
    (let ((letters (list-seq "a".."z"))) ;; list strings "a" to "z"
    (flow
    (get-string) ;; get stdin as one big string
    (tok #/_+/ t) ;; tokenize
    (mapcar [iffi (op starts-with "_") ;; map __ tokens to letters
    [chain len pred letters]])
    (apply join) ;; reconstitute
    (pprint)))

    That exact hack, oblivious to string literals and comments and such, can
    be shortened to:

    (let ((letters (list-seq "a".."z")))
    (flow
    (get-string)
    (regsub #/_+/ [chain len pred letters])
    (pprint)))

    and its ilk.


    Tokens are defined a sequences of one or more underscores, or else
    sequences of other identifiers.

    We replace an underscore token by taking the predecessor of its length,
    and indexing into the list of "a" to "z" strings: _ maps to a, __ to b
    and so on.

    A list can be used as a function, which is how letters works in the expression [chain len pred letters]. When a list is used as a
    one-argument function, the argument is a zero-based integer index which retrieves an element from the list.


    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @[email protected]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kpop 2GM@21:1/5 to Janis Papanagnou on Mon Jul 31 21:34:10 2023
    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(__/_)%_.+.___,__%_+___)
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to All on Tue Aug 1 17:22:35 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)