Revision 5041321e-be47-4037-9ed5-a02c63e39b0b - Code Golf Stack Exchange

# [Jelly], <s>32</s> 27 bytes

 ,U⁼€JẸ,E,SƲ$
 ZL«L’aL€Ç$æA/

[Try it online!][TIO-jf8jlfuz]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-jf8jlfuz]: https://tio.run/##y0rNyan8/18n9FHjnkdNa7we7tqh46oTfLjt0CYVriifQ6t9HjXMTPQBSh1uVzm8zFH/////0eqJOXrqOgpc6tUmYMpJPRYA "Jelly – Try It Online"

Now taking input at a list of lines and switched `>1×` with `’a` and using `SƲ` after `L€` instead of `FLƲƊ`. These allowed me to condense into two lines and I saved 5 bytes in total. The following values are the same as before.

`[0.0, 0.0]`=Mess 
`[0.0, 1.5707963267948966]`=Rectangle 
`[0.0, 0.7853981633974483]`=Square 
`[1.5707963267948966, 0.0]`=Triangle

---


`ZL«L` gets the minimum of height and width and `’` subtracts 1 from it. `Ç` calls the second link and at the end if the input is a single line the result of `Ç` gets logical ANDed with the previous number if there is only a single line the output will be `[0.0, 0.0]`.

In the second link: `,U` yields a list of line lengths paired with it's reverse. `J` is `range(number of lines)` and `⁼€` checks whether each of them are equal to the result of `J`. `Ẹ` (Any) yields 1 if the input is a triangle.

`E` checks if all line lengths are equal (rectangle/square).

`SƲ` with a `$` to group them into a single monad checks whether the total number of characters is a square number.


So at the end of the second link we have `[[a,b],c]` where each number is `0` or `1` indicating whether the input is a triangle, rectangular, and has square number of characters respectively.

However a square number of elements doesn't imply the input is a square since an messy input like

 a3.
 4

has a square number of elements but isn't a square. 

This is where `æA` (arctan2) comes in. `0æA0` == `0æA1` == `0`. In other words, if the input has square number of elements but is not a rectangle, then it is not a square. There are certainly more clear ways to do this but what does that matter when we have bytes to think about and we are allowed consistent arbitrary output.

AltStyle によって変換されたページ (->オリジナル) /