mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-15 13:17:41 +03:00
44 lines
710 B
C
44 lines
710 B
C
/* j/6/flip.c
|
|
**
|
|
** This file is in the public domain.
|
|
*/
|
|
#include "all.h"
|
|
|
|
|
|
/* functions
|
|
*/
|
|
u3_noun
|
|
u3qf_flip(
|
|
u3_noun hel)
|
|
{
|
|
if ( c3y == u3r_sing(1, u3h(hel)) ) {
|
|
if ( (c3y == u3t(hel)) ) {
|
|
return u3nc(1, c3n);
|
|
}
|
|
else {
|
|
c3_assert((c3n == u3t(hel)));
|
|
|
|
return u3nc(1, c3y);
|
|
}
|
|
}
|
|
else {
|
|
return u3nq
|
|
(6,
|
|
u3k(hel),
|
|
u3nc(1, c3n),
|
|
u3nc(1, c3y));
|
|
}
|
|
}
|
|
u3_noun
|
|
u3wf_flip(
|
|
u3_noun cor)
|
|
{
|
|
u3_noun hel;
|
|
|
|
if ( u3_none == (hel = u3r_at(u3x_sam, cor)) ) {
|
|
return u3m_bail(c3__fail);
|
|
} else {
|
|
return u3qf_flip(hel);
|
|
}
|
|
}
|