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

    From J Naman@jnaman2@gmail.com to comp.lang.awk on Wed Mar 8 16:40:52 2023
    From Newsgroup: comp.lang.awk

    _________ = ___(____[________])- (__+___)/(______^_____ ); # 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.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.lang.awk on Thu Mar 9 03:09:40 2023
    From Newsgroup: comp.lang.awk

    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 :-)

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From gazelle@gazelle@shell.xmission.com (Kenny McCormack) to comp.lang.awk on Thu Mar 9 05:57:57 2023
    From Newsgroup: comp.lang.awk

    In article <d6a0fdf8-b7e1-4c3c-a988-566a44bf0c9bn@googlegroups.com>,
    J Naman <jnaman2@gmail.com> 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
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From J Naman@jnaman2@gmail.com to comp.lang.awk on Thu Mar 9 16:34:08 2023
    From Newsgroup: comp.lang.awk

    On Thursday, 9 March 2023 at 00:58:01 UTC-5, Kenny McCormack wrote:
    In article <d6a0fdf8-b7e1-4c3c...@googlegroups.com>,
    J Naman <jna...@gmail.com> 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!)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@864-117-4973@kylheku.com to comp.lang.awk on Sat Mar 11 21:10:45 2023
    From Newsgroup: comp.lang.awk

    On 2023-03-09, Kenny McCormack <gazelle@shell.xmission.com> wrote:
    In article <d6a0fdf8-b7e1-4c3c-a988-566a44bf0c9bn@googlegroups.com>,
    J Naman <jnaman2@gmail.com> 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.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@864-117-4973@kylheku.com to comp.lang.awk on Sun Mar 12 03:12:06 2023
    From Newsgroup: comp.lang.awk

    On 2023-03-11, Kaz Kylheku <864-117-4973@kylheku.com> 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: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114