optional arguments, fixes

This commit is contained in:
ProgramSnail 2023-07-07 17:59:32 +03:00
parent 8647918f37
commit a208e2f42d
3 changed files with 90 additions and 24 deletions

View file

@ -213,9 +213,15 @@ def ( -- ) : begin end = {
decl scan-int : -> \int
def scan-int = \int..read: (\io..scan:)
decl print-int : ::x \int -> \unit
decl print-int : \int -> \unit
def print-int : x = \io..print: (x..show:)
decl print-int-with-comment : ::i \int -> \string? -> \unit
def print-int-with-comment : i maybe-comment = {
; \io..print: (i..show:)
var comment? = maybe-comment in \io..print: comment
}
decl scan-anything 'a[#read] : -> 'a
def scan-anything = 'a..read: (\io..scan:)
@ -272,7 +278,7 @@ exec main {
; print-anything:[int] n
; print-int: ::x 123
; print-int-with-comment: ::i 123
var & a & b & c = scan-three-t:
; \io..print: b