From 0a76eea3e27ce5ce458670bd3467f5db55822271 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Thu, 23 Dec 2021 19:12:54 -0800 Subject: [PATCH] Uncomment ifte built-in. --- joy/library.py | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/joy/library.py b/joy/library.py index 93455ab..61e1e45 100644 --- a/joy/library.py +++ b/joy/library.py @@ -1007,32 +1007,32 @@ def branch(stack, expression, dictionary): return stack, concat(then if flag else else_, expression), dictionary -##@inscribe -##@FunctionWrapper -##def ifte(stack, expression, dictionary): -## ''' -## If-Then-Else Combinator -## :: -## -## ... [if] [then] [else] ifte -## --------------------------------------------------- -## ... [[else] [then]] [...] [if] infra select i -## -## -## -## -## ... [if] [then] [else] ifte -## ------------------------------------------------------- -## ... [else] [then] [...] [if] infra first choice i -## -## -## Has the effect of grabbing a copy of the stack on which to run the -## if-part using infra. -## ''' -## (else_, (then, (if_, stack))) = stack -## expression = (S_infra, (S_first, (S_choice, (S_i, expression)))) -## stack = (if_, (stack, (then, (else_, stack)))) -## return stack, expression, dictionary +@inscribe +@FunctionWrapper +def ifte(stack, expression, dictionary): + ''' + If-Then-Else Combinator + :: + + ... [if] [then] [else] ifte + --------------------------------------------------- + ... [[else] [then]] [...] [if] infra select i + + + + + ... [if] [then] [else] ifte + ------------------------------------------------------- + ... [else] [then] [...] [if] infra first choice i + + + Has the effect of grabbing a copy of the stack on which to run the + if-part using infra. + ''' + (else_, (then, (if_, stack))) = stack + expression = (S_infra, (S_first, (S_choice, (S_i, expression)))) + stack = (if_, (stack, (then, (else_, stack)))) + return stack, expression, dictionary @inscribe -- 2.11.0