petStorm
Given a list of positive integers, output how many items are strictly less than the previous item. The first item will never be counted.
### Test cases
|Input|Output|
|:---:|:----:|
|`[1 2 5 8 12 21 51]`|`0`|
|`[4 2 5 2 1 5 2]`|`4`|
|`[4 5 3 6 2 7 1 8]`|`3`|
|`[3 3 3 1 1 1]`|`1`|
Adám
# [APL (Dyalog Unicode)], 6 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?") [^SBCS^](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Anonymous tacit prefix function. The rare case of ASCII-only APL!
```apl
+/2>/+
```
[Try it online!][TIO-k84oab5w]
|Code|Explanation
|-|-
|`+`|the numbers
|`2>/`|pairwise greater-than
|`+/`|sum
[APL (Dyalog Unicode)]: https://www.dyalog.com/
[TIO-k84oab5w]: https://tio.run/##SyzI0U2pTMzJT///X1vfyE5f@3/ao7YJj3r7HnU1P@pd86h3y6H1xo/aJj7qmxoc5AwkQzw8g/@nKRgqGCmYKlgoGBopGBkqmBpypSmYgIWMgFJAEsw3VTBWMAOKmAPFLIAixmBoCIIA "APL (Dyalog Unicode) – Try It Online"
Answer #2
xigoi
# [Jelly], 3 bytes
>ƝS
[Try it online!][TIO-khpcph9k]
[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-khpcph9k]: https://tio.run/##y0rNyan8/9/u2Nzg////R5voGOmYArEhiIwFAA "Jelly – Try It Online"
## Explanation
>ƝS Main monadic link
Ɲ For each pair of neighboring elements:
> Is greater than?
S Sum
ajc2
# Kotlin, 33 bytes
{zipWithNext().count{(a,b)->a>b}}
[Try it online!][TIO-khpwsdik]
[Kotlin]: https://kotlinlang.org
[TIO-khpwsdik]: https://tio.run/##bZDRS8MwEMbf91ecpQ8JZMWsmw6xhb0Ig6HCHnzupMVgTEt7G2Lp317vsraKLoRwyff7Lnz3XqI1rj9lFow73cHONHi/dZhGQsI8BSoh6dsvU70YfHvMP1HI6LU8OmxFpg5ynmbpoev64ujgIzOOXO0MaHFHzBtsICGheiqEf@Zl6Q@6awULBSsFawWaqgU9rLQELOFa/YWXI0ynPheSZYKXl2ACYgU3nr/1lrXvHP@DY0/GnuEtB5lg7Vnpz6KshWCLAh9f0rzOAcfEY@o658yMRjRSISexqo1DEYQs8WxD3wgg@EFMIdh@lQyfTMLkt04ED5vtDiAk8pc1t01@GX/e7PcD2M26/hs "Kotlin – Try It Online"
Answer #4
Draco18s
# [Runic Enchantments], 24 bytes
0il}i{l1-(3*?~$;:4s)+S2?
[Try it online!][TIO-khv468eu]
[Runic Enchantments]: https://github.com/Draco18s/RunicEnchantments/tree/Console
[TIO-khv468eu]: https://tio.run/##KyrNy0z@/98gM6c2szrHUFfDWMu@TsXayqRYUzvYyP7/fwsFIwVDBRMFYyA0VDBXsFAwAwA "Runic Enchantments – Try It Online"
The `l}i{l1-( ?` section handles reading input (and if there is more input to read). There isn't, `~$;` is called, printing the answer and terminating, otherwise the `3*` results in a jump to `:4s)+S`, checking for less-ness and incrementing the counter. `2?` then insures that looping resumes at the correct position.