This commit is contained in:
ProgramSnail 2023-05-22 22:02:31 +03:00
parent a2e305c27f
commit d38d75c9d8
8 changed files with 90 additions and 56 deletions

View file

@ -1,9 +1,9 @@
basic (Float : #Ord #Div #Show)
basic (Int : #Ord #IDiv #Show)
basic (String : #Ord #Show #CharContainer #Copy)
basic (Char : #Ord #Show #Copy)
basic (Bool : #Ord #Show #Copy)
basic (Unit : #Show #Copy)
basic (Float : #Ord #Div #Str)
basic (Int : #Ord #IDiv #Str)
basic (String : #Ord #Str #CharContainer #Copy)
basic (Char : #Ord #Str #Copy)
basic (Bool : #Ord #Str #Copy)
basic (Unit : #Str #Copy)
//
@ -148,8 +148,10 @@ namespace var Ord {
typeclass Show =
& var show : -> String
// typeclass Read = // TODO
// & var read : String -> Read
typeclass Read =
& var read : String -> Read
typeclass (Str : #Show #Read)
// typeclass DebugShow = // TODO
// & debug_show : -> String
@ -205,20 +207,20 @@ def ( -- ) : begin end = {
var current = begin
return (while current < end do {
; current += 1
bring current
//bring current - 1
bring current - 1
})
}
decl func : String -> Int -> Int
def func : s i = {
; print: s
var x = s
; print: (i.show:)
return 5
}
exec main {
for i in 0--9 do func: "abacaba" (i - 1)
for i in 0--19 do func: "a" (i * 2 +. 3)
; print: ({
if true then bring scan: else { ; print: "aaa" }
bring "nothing"