• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

A categorical programming language


Commit MetaInfo

修订版729412cc5fe875737b9dc5432eac39b4b9957638 (tree)
时间2022-03-01 10:39:55
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

jelly: Optimize a few odd and even functions.

更改概述

差异

--- a/jelly/src/main.rs
+++ b/jelly/src/main.rs
@@ -68,8 +68,10 @@ fn main() -> std::io::Result<()> {
6868 rw!("list-unroll-fold-nil"; "(comp nil (fold ?x ?f))" => "?x"),
6969 rw!("list-unroll-fold-cons"; "(comp cons (fold ?x ?f))" => "(comp (pair fst (fold ?x ?f)) ?f)"),
7070
71+ // Boolean negation
7172 rw!("bool-t-not"; "(comp t not)" => "f"),
7273 rw!("bool-f-not"; "(comp f not)" => "t"),
74+ rw!("bool-not-invo"; "(comp not not)" => "id"),
7375
7476 // IEEE 754 addition
7577 rw!("f-add-comm"; "(comp (pair snd fst) f-add)" => "f-add"),
@@ -86,6 +88,15 @@ fn main() -> std::io::Result<()> {
8688 // improvement!
8789 rw!("f-negate-invo"; "(comp f-negate f-negate)" => "id"),
8890 rw!("f-recip-invo"; "(comp f-recip f-recip)" => "id"),
91+
92+ // IEEE 754 even functions
93+ rw!("f-sign-negate-ana"; "(comp f-negate f-sign)" => "(comp f-sign not)"),
94+ rw!("f-sign-negate-kata"; "(comp f-sign not)" => "(comp f-negate f-sign)"),
95+ rw!("f-cos-even"; "(comp f-negate f-cos)" => "f-cos"),
96+
97+ // IEEE 754 odd functions
98+ rw!("f-sin-odd-ana"; "(comp f-negate f-sin)" => "(comp f-sin f-negate)"),
99+ rw!("f-sin-odd-kata"; "(comp f-sin f-negate)" => "(comp f-negate f-sin)"),
89100 ];
90101
91102 let tree = load_tree(&mut std::io::stdin())?;