Well finally manage a one liner recursive DEF for reverse function. I know in grand scheme of things this is trivial but I have found it interesting learning.
'recursive reverse.bas for SmallBASIC 0.12.2 [B+=MGA] 2016-01-16 started post 2016-01-20
'test definition of interesting idea for recursive function definition
'deconstruct D's single line reverse function recursive definition, works!
'func revs(s) 'works
' if len(s)=1 then
' revs=s
' else
' revs=revs(mid(s,2))+left(s,1)
' end if
'end
'pack above into two line recursive definition, this needs no additional variable help
'(as doing it in straight forward looping and rebuilding with MID would need
' (at least one var for loop and recommend one for build var) and works!)
'func revs(s):if len(s)=1 then revs=s else revs=revs(mid(s,2))+left(s,1)
'end
' OK try packing down to one-liner
' def wont work the error: "PARAM COUNT ERROR@11 7=F 15,
' ha! So SmallBASIC finds D's one recursive DEF unbelievable too!
'def revs(s)=iff(len(s)=1,s,revs(mid(s,2))+left(s,1) )
' Holy Macaroni!!!
'I was just about to give up on getting SmallBASIC version of D's one liner,
'but decide to try one more thing after trying to decode error message again
'success!!!! from one additional set of parenthesis
def revs(s)=iff( len(s)=1,s,( revs( mid(s,2) ) +left(s,1) ) )
while 1
?:input "Enter a string or number to reverse, just enter quits ";test
if len(test) then ? "reverse of '";test;"' is '";revs(test);"'" else exit
wend