shrub/j/f/flip.c
2014-11-06 11:49:41 -08:00

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(u3v_sam, cor)) ) {
return u3m_bail(c3__fail);
} else {
return u3qf_flip(hel);
}
}