[Question]
  [
Your task is to write a computer program or function that takes a list of nonnegative integers of at least length 2 and determines if they are a "zigzag". A sequence is a zigzag if and only if the numbers alternate in being larger and smaller than the number that comes before them. For example \$[1,2,0,3,2]\$ and \$[4,2,3,0,1]\$ are zigzags but \$[1,2,0,0,3,1]\$ and \$[1,2,3,1]\$ are not.
For your decision you should output one of two different consistent values for each possibility (zigzag and not zigzag).
The code-points of your program or function must also be a zigzag itself. This means that when you take the sequence of code-points it should be a zigzag.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so answers will be scored in bytes with fewer bytes being better.
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
IṠIỊẸ
```
Returns \$0\$ (zigzag) or \$1\$ (not zigzag).
The code points are \$[73, 205, 73, 176, 174]\$ in the [Jelly code page](https://github.com/DennisMitchell/jellylanguage/wiki/Code-page).
[Try it online!](https://tio.run/##y0rNyan8/9/z4c4Fng93dz3cteP/4fZHTWuAyP3//2guBSBSiDY31lEwMjDVUQAxDM3NQIRJrA5IylDHSMdAx1jHCMI1AXKNgQKGsVwKIJFohBqQKkOEJhAnlisWAA "Jelly – Try It Online")
### How it works
```
IṠIỊẸ  Main link. Argument: A (array)
I      Increments; compute the forward differences of A.
 Ṡ     Take their signs.
       A is zigzag iff the signs are alternating.
  I    Take the increments again.
       Alternating signs result in an increment of -2 or 2.
       Non-alternating signs result in an increment of -1, 0, or 1.
   Ị   Insignificant; map each increment j to (|j| ≤ 1).
    Ẹ  Any; return 0 if all results are 0, 1 in any other case.
```
[Answer]
# [K (ngn/k)](https://gitlab.com/n9n/k), 23 bytes
```
{*/ 0 >1_ *':1_ -': x }
```
[Try it online!](https://tio.run/##fY7PDoIwDMbve4qmkLDB0E08bcqLoBETxBgMJowDBPHVsWLwaA9t8/u@/qni@lpPkzM4hGtQkOoThIGhHAcGOhjxn8ZYaVbgWA6KcMDlgevIc8LDJwoZ@CpyUiLOOsb7CBOpI652hYhVWtAILSLPrDs2F45osb24ls4K1prBz/pXY0robP6oLM/L8@1uO9vbRhxH1mYaNvRbQhmsPhLYUpsQ0gv4Oj4ebdUCko9Ojhk4@AWNTG8 "K (ngn/k) – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 87 bytes
```
f(a:b:c:d)|(>)a b,b<c=f$b:c:d |(<)a b,b>c=f$b:c:d |1>0=1>12
f[a ] =1<12
f(a:b:_)= a/= b
```
[Try it online!](https://tio.run/##hc2xDsIgEMbx3ae4NAyQGBVHwrHoW6gxRyspsVCCjH131LrUwbjd/Yfv19PjfhuG6kMac4EjFdocesrVcVJWtaoTEzeCwK6tbtGxucHE9aeZRZNmh9LI/cqdCC6AUr/veecqEGiLYGsgHzFlHwtzLFCCMXfNP8z8xs5xob2eb66pTw "Haskell – Try It Online")
I wanted to get the ball rolling in terms of Haskell answers. I can't see a way to improve this yet, but I am convinced it can be done. I'm looking forward to what people can do from here.
[Answer]
# [MATL](https://github.com/lmendo/MATL), 9 bytes
```
dt?ZSd]pA
```
[Try it online!](https://tio.run/##y00syfn/P6XEPio4JbbA8b9qtKGOkY6BjrGOUSyXarQJkGMM5BqCOBAZkBycC2Ua6SgY6ihASLCAgQIYguUUjBVMFEwhTHMFIwVTBUMFS7DhQAZIwDD2P4oJIDIWAA "MATL – Try It Online") Or [verify all test cases](https://tio.run/##y00syfmf8D@lxD4qOCW2wPG/S8j/aEMdIx0DHWMdo1iuaBMg2xjIMwSyIeIgGRgPwjLSUTDUUUCQQCEDBTAESSoYK5gomIJZ5gpGCqYKhgqWIIOBNIhvGAsA)
My first ever MATL program! The penultimate `p` was added for the zigzag requirement.
Explanation:
```
d    %take the difference between successive elements of input
t    %duplicate that
?    %if that is all non-zero
  ZS %take the sign of those differences (so input is all `-1`s and `1`s now)
  d  %take the difference of that (so if there are successive `1`s or `-1`s, this will have a 0)
]    %end-if
p    %take the product of topmost stack vector (will be 0 if either the original difference or 
     % the difference-of-signs contained a 0)
A    %convert positive products to 1 (since OP specifies "you should output one of two different consistent values for each possibility ")
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~225~~ ~~223~~ ~~161~~ 139 bytes
-2 bytes thanks to Jakob  
-62 bytes thanks to Dennis  
```
e={eval }.pop()
p ="i"+"n"+"p"+"u"+"t ( "
s=e(p +")")
e(p +"` a"+"l"+"l([(x<y>z)+(x>y<z)f"+"o"+"r x,y,z i"+"n zip(s,s [1: ],s [2: ])])` )")
```
[Try it online!](https://tio.run/##RY/RasMwDEXf/RUXvdRe3FEH@tDQ9EdCWEPmskCJRZwNO2PfnikdrA9HutKFi8R5/ghjufbh3ddEtPr62391d/y8cmBtFKOmgQoaBRY@hRkapGLtNaMgQ0b9qSs6ce8butHpnC@LKXS65PNibrINwoRks13wyMQysI42onEV2q2X0k1rrpDUVe4RY@9adQsT3jCM2GH3cqwU5ilXPvke2@EKPvWe54q7GB@vKNU4W1pn3cHuT/bY/i8OTyn1OZTb8As "Python 2 – Try It Online")
Credits for the bumpy algorithm goes to [this answer](https://codegolf.stackexchange.com/a/93062/) 
`input`, `print`, `exec`, `def` and `lambda` aren't bumpy so I only got `eval` left, which is stored on `e`  
There are 2 main ways to bypass the restriction, placing `"+"` or  between the non-bumpy pairs, I opted for the former ( is shorter for each use, but it would need `replace(' ','')` resulting in more bytes)  
Since `print` isn't bumpy, I can't use it directly, and since it isn't a funcion I can't use it inside `eval()`, so I had to use `input(result)` to output the result 
[Answer]
# [Ohm v2](https://github.com/nickbclifford/Ohm), 5 [bytes](https://github.com/nickbclifford/Ohm/blob/master/code_page.md)
```
δyδ½Å
```
[Try it online!](https://tio.run/##y8/INfr//9yWynNbDu093Pr/f7ShjpGOsY5hLAA "Ohm v2 – Try It Online")
The indices of the characters are \$[131,121,131,16,165]\$ in the linked code page.
### How it works
```
δyδ½Å – Full program / Single-argument block.
δy    – The signs of the deltas of the input 
  δ   – The differences of the signs. Results in a sequences of 2's or -2's for
        bumpy arrays, as the signs alternate, giving either -1-1=-2 or 1-(-1)=2.
    Å – Check if all elements yield truthy results when...
   ½  – Halved.
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~7~~ 5 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
¥ü*dZ
```
-2 bytes by taking the answer from the same challenge without source restriction. [All credit goes to *@Grimmy*](https://codegolf.stackexchange.com/a/199062/52210), so make sure to upvote his answer as well!!
Outputs `0` for zigzagging and `1` for non-zigzagging sequences.
The code points are [`[165,252,42,100,90]`](https://tio.run/##yy9OTMpM/f//6L4jbcXB2f//H1p6eI9WShQA) in the [05AB1E code page](https://github.com/Adriandmen/05AB1E/wiki/Codepage).
[Try it online.](https://tio.run/##yy9OTMpM/f//0NLDe7RSov7/jzY0M9VRMDI10lEwAWJDAwMdBUuDWAA)
**Original 7-byter:**
```
¥.±¥Ä;P
```
Outputs `1.0` for zigzagging and `0.0` for non-zigzagging sequences.
The code points are [`[165,46,177,165,196,59,80]`](https://tio.run/##yy9OTMpM/f//6L4jbcXB2f//H1qqd2jjoaWHW6wDAA) in the [05AB1E code page](https://github.com/Adriandmen/05AB1E/wiki/Codepage).
[Try it online.](https://tio.run/##yy9OTMpM/f//0FK9QxsPLT3cYh3w/3@0oZmpjoKJmY6Cobk5kADxDC2BXFNLHQULg1gA)
**Explanation:**
```
¥        # Take the forward differences (deltas) of the (implicit) input-list
         #  i.e. [1,2,0,3,2,3] → [1,-2,3,-1,1]
 ü       # For each overlapping pair:
  *      #  Multiply them together
         #   → [[1,-2],[-2,3],[3,-1],[-1,1]] → [-2,-6,-3,-1]
   d     # Check for each whether it's non-negative (>= 0)
         #  → [0,0,0,0]
    Z    # Take the maximum of that
         #  → 0
         # (after which it is output implicitly as result)
¥        # Take the forward differences (deltas) of the (implicit) input-list
         #  i.e. [1,2,0,3,2,3] → [1,-2,3,-1,1]
 .±      # Calculate the sign for each of them (-1 if a<0; 0 if 0; 1 if a>0)
         #  → [1,-1,1,-1,1]
   ¥     # Calculate the deltas of those
         #  → [-2,2,-2,2]
    Ä    # Take the absolute value of each
         #  → [2,2,2,2]
     ;   # Halve each
         #  → [1.0,1.0,1.0,1.0]
      P  # Take the product of the list resulting in either 1.0 or 0.0
         #  → 1.0
         # (after which it is output implicitly as result)
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt/) `-!`, ~~16~~ 14 bytes
Well, this ain't pretty but I'm just happy it works!
Outputs `true` for zig-zag or `false` if not.
```
ä'- m'g ä'a èÍ
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=5CctIG0nZyDkJ2Eg6M0=&input=WzIyOCwzOSw0NSwzMiwxMDksMzksMTAzLDMyLDIyOCwzOSw5NywzMiwyMzIsMjA1XQotIQ==)
Codepoints are `[228,39,45,32,109,39,103,32,228,39,97,32,232,205]` and included as the test in the link above.
---
## Explanation
```
                   :Implicit input of array
ä'-                :Consecutive differences
    m'g            :Map signs
        ä'a        :Consecutive absolute differences
             Í     :Subtract each from 2
            è      :Count the truthy (non-zero) elements
                   :Implicitly negate and output resulting boolean.
```
[Answer]
# [tinylisp](https://github.com/dloscutoff/Esolangs/tree/master/tinylisp), 154 bytes
```
(d Z(q ( ( X Y T )(i T(i(l X Y )(i(l(h T)Y )(F(c Y T ) ) 0 )(i(l Y X )(i(l Y(h T ) )(F(c Y T ) ) 0)0 ) )(e(e X Y)0
( d F(q ( ( L )(Z(h L )(h(t L ) )(t(t L
```
[Tr y i t o n lin e!](https://tio.run/##bY09DsIwDIX3nuKN9pY2nCETY4bSlVZqpAqByMLpg19bJEKRB7@fz0lOt9eSnvdSZMQgD4hNjwsiVBKiJFlWr1QyIyp1kOvG2LitM99/FDl2NaduzSaZ@KK6RjAi7H@erRnsjnuWzG0qUxUJINWiU9Vmdx3aL2dd5c1VNHsHX2Uny7yl7YEj@Zv6v9yRpCtv "tinylisp – Try It Online")
### Explanation
`(load library)` is disallowed by the source restriction, so we have to use only builtins. Since these are each one character, we can just add spaces wherever necessary to make the codepoints zigzag.
The solution uses a pair of mutually recursive functions. `F` takes a list of at least two elements and calls `Z` with three arguments: the first two elements (`X` and `Y`) and the remainder of the list (`T`). `Z` does most of the work:
* If `T` is not empty:
	+ If `X` is less than `Y`:
		- If head of `T` is also less than `Y`, call `F` with `Y` prepended to `T`
		- Otherwise, return false
	+ Else, if `Y` is less than `X`:
		- If `Y` is also less than head of `T`, call `F` with `Y` prepended to `T`
		- Otherwise, return false
	+ Else (`X` equals `Y`), return false
* Else (`T` is empty, `X` and `Y` represent a two-element list):
	+ Return true if `X` is not equal to `Y`, false otherwise
Ungolfed:
```
(load library)
(def zigzag?
 (lambda (X Y T)
  (if T
   (if (less? X Y)
    (if
     (less? (head T) Y)
     (zigzag-list? (cons Y T))
     0)
    (if (less? Y X)
     (if
      (less? Y (head T))
      (zigzag-list? (cons Y T))
      0)
     0))
   (equal? (equal? X Y) 0))))
(def zigzag-list?
 (lambda (L)
  (zigzag?
   (head L)
   (head (tail L))
   (tail (tail L)))))
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 [bytes](https://github.com/DennisMitchell/jellylanguage/wiki/Code-page)
```
IṠµaIẠ
```
[Try it online!](https://tio.run/##y0rNyan8/9/z4c4Fh7Ymej7cteD////RhjpGOgZAaKxjGAsA "Jelly – Try It Online")
Returns `1` for truthy, `0` for falsy.
[Codepoints](https://tio.run/##AR8A4P9qZWxsef//w5hKaeKxruKAmf///0nhuaDCtWFfxp1Q): `[73, 205, 9, 97, 73, 171]` ([valid](https://tio.run/##y0rNyan8/9/z4c4Fh7Ymej7cteD/4RlemY82rnvUMPNwO4oMAA))
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 61 bytes
```
{ [*] ($_[{1…*} ] Z<@$_)Z+^ ($_[{1…*} ] Z>@$_[{2…*} ])}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/WiFaK1ZBQyU@utrwUcMyrVqFWIUoGweVeM0o7Th0cTsHEN8Iytes/V@cCDJGI9pQx1THUMcoVtOaCyFkpGOMKgRSY6ljgSlkCRLiUqfILep6@UUpxXpqaXpAs/8DAA "Perl 6 – Try It Online")
The code points are:
```
(123 32 91 42 93 32 40 36 95 91 123 49 8230 42 125 32 93 32 90 60 64 36 95 41 90 43 94 32 40 36 95 91 123 49 8230 42 125 32 93 32 90 62 64 36 95 91 123 50 8230 42 125 32 93 41 125)
```
And yes, those are unicode characters in there. This is more or less my original solution, with a few spaces and curly braces mixed in.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 10 bytes
```
¥DÄ/¥(Ä2QP
```
[Try it online!](https://tio.run/##MzBNTDJM/f//0FKXwy36h5ZqHG4xCgz4/z/aUMdIx0DHWMcoFgA "05AB1E – Try It Online")
**Explanation**
```
¥           # calculate deltas of input
 DÄ/        # divide each by its absolute value
    ¥       # calculate deltas
     (      # negate each
      Ä     # absolute value of each
       2Q   # equals 2
         P  # product
```
Code points are: `[165, 68, 196, 47, 165, 40, 196, 50, 81, 80]`
]