mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-02 20:28:18 +00:00
optional arguments, fixes
This commit is contained in:
parent
8647918f37
commit
a208e2f42d
3 changed files with 90 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue