vector design decision and baby steps...

Based on conversations yesterday with whiteknight, dukeleto, Notfound, bubaflub, sorear, cotto_work, soh_cah_toa, and others, I've decided that my initial design will use Resizable*Array for everything (even vectors of length 1). And for now, I'll support Integer, Float, and String. For reasons relating to the R language, I'll want my own logical (Boolean) using integers, but I'm not going there, yet. In the following example, 'seq' stands for sequence, 'c' is used to combine things, 'str' is for structure, 'length' for the number of elements, 'setseed' and 'rexp' giving pseudo-random draws from the exponential distribution via libRmath.so; '<-' is the preferred syntax for assignments.


jay@bayesman:~/Desktop/NQR$ ./installable_nqr
Not Quite R for Parrot VM.
> a <- seq(1, 10, 2)
> b <- seq(1.5, 10, 2)
> print(a)
1 3 5 7 9
> print(length(a))
5
> print(b)
1.5 3.5 5.5 7.5 9.5
> x <- c(a, b)
> print(x)
1 3 5 7 9 1.5 3.5 5.5 7.5 9.5
>
> print(str(a))
ResizableIntegerArray
> print(str(b))
ResizableFloatArray
> print(str(x))
ResizableFloatArray
>
> print(str(1.234))
ResizableFloatArray
>
> setseed(1,2)
> a <- rexp(100)
> print(a)
12.8204345965805
> a <- rexp(100)
> print(a)
86.6059778489285

Questions regarding this sort of "interactive" mode:

1. I turned off the automatic printing that squaak had (thanks to pmichaud: in Compiler.pm, method autoprint($value) { }). But now I have to explicitly print what I want to see. I would like 'print' to be done automatically for any line that isn't an assignment. So, for example:


> a <- 99
> a
99
>

Note that the first line doesn't print while the second does, without explicitly asking for it. Any advice? I don't think it is as simple as customizing this 'autoprint'.

2. When working interactively with installable_nqr, I'd like the interpreter to accept things across multiple lines (e.g. sensing when the command isn't "complete" and giving another line for input). Such as (with the '+' an indication that the previous line wasn't complete, so more should be typed into the console):


> a <- 1
> if (a==1) {
+ print("Hello")
+ }
Hello
>

Has this particular type of wheel been invented, or am I the first to ask about it? Any hints? If it's likely not that hard, I'd love it. If too hard, not worth the time and effort at this point.