0 Members and 3 Guests are viewing this topic.
inline HP PPL support is definitively a good idea. Also if the calc ever supports ASM maybe Source could allow inline ASM opcodes?
function test[K](a as list[K]) as K { return a[1]}@exportfunction main(a as list[int]) as int { return test(a)}
function do[A as int,B as int](a as A,b as B) as A { return a+b}@exportfunction main[E as int](c as E,d as E) as E { return do(c,d)}
@exportfunction test1() { for i in range(1,10) { print(i) }}
@exportfunction test2() { @downloop for i in range(10,1,-1) { print(i) }}
@exportfunction test3() { local a = [5,8,7,3] for v in a { print(v) }}
@exportfunction test4() { local a = [5,8,7,3] for i,v in a.pairs() { print(i~" "~v) }}
@exportfunction test5() { local a = [5,8,7,3] for newv in myOwnIter(a) { print(newv) }}iterator myOwnIter(a as list) as int { for v in a { return (v as int) + 1 }}
@exportfunction test5() { local a as list = [5,8,7,3] for newv in a.myOwnIter() { print(newv) }}iterator list.myOwnIter(a as list) as int { for v in a { return (v as int) + 1 }}
Can you have type parameters of a rank higher than 1? That always bugged me in Java.
Also I was always worried about For loops, because I know some languages seem to try very hard at making them weird. Even HP PPL is borderline with its FROM TO STEP DO syntax. Casio BASIC is the worst, I think, because it even inverts stuff. Instead of For(A,1,7,2) you have to write For 1->A To 7 Step 2 which is really weird.