• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#windowsobjective-ccocoaqt誰得pythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


Commit MetaInfo

修订版4b7a44437765ee6f2017ee0adb6727d9b8daade4 (tree)
时间2021-08-14 12:24:30
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

Allow 0 as a valid nat in Scheme.

更改概述

差异

--- /dev/null
+++ b/hive/nat/square.cammy
@@ -0,0 +1 @@
1+(comp dup (uncurry nat/mul))
--- a/stub.scm
+++ b/stub.scm
@@ -39,9 +39,9 @@
3939 (signal (condition (list 'exn 'message (sprintf "Invalid argument ~A: ~A" arg why)))))
4040 (define (arg-unit x) '())
4141 (define (arg-bool x) (if (boolean? x) x (arg-error x "not bool")))
42-(define (arg-nat x) (if (> x 0) x (arg-error x "not a natural number")))
42+(define (arg-nat x) (if (>= x 0) x (arg-error x "not a natural number")))
4343 (define (arg-int x)
44- (if (number? x) (if (> x 0) (cons x 0) (cons 0 (abs x))) (arg-error x "not an integer")))
44+ (if (number? x) (if (>= x 0) (cons x 0) (cons 0 (abs x))) (arg-error x "not an integer")))
4545 (define (arg-list p) (lambda (x) (map p x)))
4646
4747 (define (fold-left kn kc l) (if (null? l) kn (kc (car l) (fold-left kn kc (cdr l)))))