phino-0.0.154: test-resources/evaluate-packs/reduces-the-branches-of-a-fork-through-morphing.yaml
# SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
# A branch is where a 'morph' operand earns its place: the condition comes
# down through π» and answers a symbol nobody has decided, both branches reach
# a normal form through π, a call of 'plus' nobody has fired, an 'evaluate'
# line fires each of them (#1874), and the answer is the first. Every line of
# the firing points back at the line that minted the symbol it carries, which
# is how the dependencies between firings are read. The dispatch of Ο that
# ends the program is what fires the fork.
symbolic: |
- Ξ»: L_number_gt
dataize:
πΏ1: $.Ο
πΏ2: $.x
π: Ξ¦.bool( Ο β¦ β¦ Ξ» β€ π β§ )
- Ξ»: L_number_plus
dataize:
πΏ1: $.Ο
πΏ2: $.x
π: Ξ¦.number( Ο β¦ β¦ Ξ» β€ π β§ )
- Ξ»: L_fork
dataize:
πΏ1: $.Ο
morph:
π1: $.then
π2: $.else
evaluate:
π3: π1
π4: π2
π: π3
location: 'Q.@'
input: >
β¦ bytes(Ο) β¦ β¦β§,
bool(Ο) β¦ β¦ if β¦ β¦ Ο β¦ β
, then β¦ β
, else β¦ β
, Ξ» β€ L_fork β§ β§,
number(Ο) β¦ β¦
gt(Ο, x) β¦ β¦ Ξ» β€ L_number_gt β§,
plus(Ο, x) β¦ β¦ Ξ» β€ L_number_plus β§ β§,
@ β¦ 5.gt( 0 ).if( 1.plus( 2 ), 3.plus( 4 ) ).Ο β§
result: 'π2:Ξ»'
protocol: |
π(Ξ¦.Ο):
πΒ·0Β·1 := 5
πΒ·0Β·2 := πΒ·0Β·1.gt( x β¦ 0 )
πΌ(L_number_gt):
π»(Ξ¦.aπ΅0):
π(Ξ¦.aπ΅0):
πΒ·1Β·1 := 5
πΒ·1Β·2 := Ξ¦.bytes( Ο β¦ 40-14-00-00-00-00-00-00:Ξ )
πΏΒ·1Β·1 := 40-14-00-00-00-00-00-00 # 5.0
πΏ1Β·1 := πΏΒ·1Β·1 # π»(ΞΎ.Ο)
π»(Ξ¦.aπ΅1):
π(Ξ¦.aπ΅1):
πΒ·1Β·3 := 0
πΒ·1Β·4 := Ξ¦.bytes( Ο β¦ 00-00-00-00-00-00-00-00:Ξ )
πΏΒ·1Β·2 := 00-00-00-00-00-00-00-00 # 0.0
πΏ2Β·1 := πΏΒ·1Β·2 # π»(ΞΎ.x)
πΒ·1Β·5 := Ξ¦.bool( Ο β¦ π1:Ξ» ) # π
π(πΒ·1Β·5):
πΒ·1Β·6 := Ξ¦.bool( Ο β¦ π1:Ξ» )
πΒ·1Β·7 := πΒ·1Β·6 # π(πΒ·1Β·5)
πΒ·0Β·3 := πΒ·1Β·6.if( then β¦ 1.plus( 2 ) )
πΒ·0Β·4 := πΒ·0Β·3( else β¦ 3.plus( 4 ) )
πΌ(L_fork):
π»(Ξ¦.aπ΅2):
π(Ξ¦.aπ΅2):
πΒ·2Β·1 := Ξ¦.bool( Ο β¦ π1:Ξ» )
πΏ1Β·2 := π»(π1:Ξ») # π»(ΞΎ.Ο)
π(Ξ¦.aπ΅3):
πΒ·2Β·2 := 1
πΒ·2Β·3 := πΒ·2Β·2.plus( x β¦ 2 )
π1Β·2 := πΒ·2Β·3 # π(ΞΎ.then)
π(Ξ¦.aπ΅4):
πΒ·2Β·4 := 3
πΒ·2Β·5 := πΒ·2Β·4.plus( x β¦ 4 )
π2Β·2 := πΒ·2Β·5 # π(ΞΎ.else)
πΌ(L_number_plus): # πΌ(π1)
π»(Ξ¦.aπ΅5):
π(Ξ¦.aπ΅5):
πΒ·3Β·1 := 1
πΒ·3Β·2 := Ξ¦.bytes( Ο β¦ 3F-F0-00-00-00-00-00-00:Ξ )
πΏΒ·3Β·1 := 3F-F0-00-00-00-00-00-00 # 1.0
πΏ1Β·3 := πΏΒ·3Β·1 # π»(ΞΎ.Ο)
π»(Ξ¦.aπ΅6):
π(Ξ¦.aπ΅6):
πΒ·3Β·3 := 2
πΒ·3Β·4 := Ξ¦.bytes( Ο β¦ 40-00-00-00-00-00-00-00:Ξ )
πΏΒ·3Β·2 := 40-00-00-00-00-00-00-00 # 2.0
πΏ2Β·3 := πΏΒ·3Β·2 # π»(ΞΎ.x)
πΒ·3Β·5 := Ξ¦.number( Ο β¦ π2:Ξ» ) # π
π(πΒ·3Β·5):
πΒ·3Β·6 := Ξ¦.number( Ο β¦ π2:Ξ» )
πΒ·3Β·7 := πΒ·3Β·6 # π(πΒ·3Β·5)
π3Β·2 := πΒ·3Β·7 # πΌ(π1)
πΌ(L_number_plus): # πΌ(π2)
π»(Ξ¦.aπ΅7):
π(Ξ¦.aπ΅7):
πΒ·4Β·1 := 3
πΒ·4Β·2 := Ξ¦.bytes( Ο β¦ 40-08-00-00-00-00-00-00:Ξ )
πΏΒ·4Β·1 := 40-08-00-00-00-00-00-00 # 3.0
πΏ1Β·4 := πΏΒ·4Β·1 # π»(ΞΎ.Ο)
π»(Ξ¦.aπ΅8):
π(Ξ¦.aπ΅8):
πΒ·4Β·3 := 4
πΒ·4Β·4 := Ξ¦.bytes( Ο β¦ 40-10-00-00-00-00-00-00:Ξ )
πΏΒ·4Β·2 := 40-10-00-00-00-00-00-00 # 4.0
πΏ2Β·4 := πΏΒ·4Β·2 # π»(ΞΎ.x)
πΒ·4Β·5 := Ξ¦.number( Ο β¦ π3:Ξ» ) # π
π(πΒ·4Β·5):
πΒ·4Β·6 := Ξ¦.number( Ο β¦ π3:Ξ» )
πΒ·4Β·7 := πΒ·4Β·6 # π(πΒ·4Β·5)
π4Β·2 := πΒ·4Β·7 # πΌ(π2)
πΒ·2Β·6 := π3Β·2 # π
πΒ·2Β·7 := π3Β·2 # π(πΒ·2Β·6)