\e 1?

132 views
Skip to first unread message

stevan

unread,
Jan 2, 2014, 3:26:13 PM1/2/14
to kona...@googlegroups.com
any plans to add this in the near future?

nice work kevin!

Kevin Lawler

unread,
Jan 2, 2014, 4:40:14 PM1/2/14
to kona...@googlegroups.com
I wouldn't recommend adding \e 1 with the current architecture. It
would work but it would be kludgey. With the right stack architecture
you get \e 1 for free.

I'd need a couple free weeks to build a stack arch based version. No
ETA on that.

Kevin



On Thu, Jan 2, 2014 at 12:26 PM, stevan <s...@nsl.com> wrote:
> any plans to add this in the near future?
>
> nice work kevin!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Kona Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kona-dev+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

stevan

unread,
Jan 2, 2014, 4:52:49 PM1/2/14
to kona...@googlegroups.com
i tried running my little ray-tracer and it complained with a length error.  

but where?  

  R
{[k;n]"P5\n",(5:n,n),"\n255\n",_ci _.5+15.9375*N[n*1.;C[k;0 -1 0.]1.]'+|@[n _vs!n*n;0;|:]}
  R[3]32
length error
 
where does one go from here?

Tom Szczesny

unread,
Jan 2, 2014, 5:34:30 PM1/2/14
to kona...@googlegroups.com
Is the ray-tracer displayed correctly?
I keyed it in separately into 3 distinct systems (Kona on Cygwin, Kona on Linux, and k3.2).
In each case, I got "type error".

Tom Szczesny

unread,
Jan 2, 2014, 6:00:27 PM1/2/14
to kona...@googlegroups.com
Running the ray-tracer on k3.2 with \e 1
results in "type error" with the caret under the "C"

Bakul Shah

unread,
Jan 2, 2014, 6:12:26 PM1/2/14
to kona...@googlegroups.com
Where are N and C defined?

In general you can always execute the body of a function after substituting arguments:

$ k
  k:3
  n:32
  "P5\n",(5:n,n),"\n255\n",_ci _.5+15.9375*N[n*1.;C[k;0 -1  0.]1.]'+|@[n _vs!n*n;0;|:]
value error
C
^
parse error

stevan

unread,
Jan 2, 2014, 10:54:24 PM1/2/14
to kona...@googlegroups.com
it ran successfully in k2.  i don't have access to k3, but i can't imagine there's much of a difference.

have you tried the other versions on the site?

Tom Szczesny

unread,
Jan 2, 2014, 11:57:30 PM1/2/14
to kona...@googlegroups.com
Sorry for the confusion -- I was not that familiar with the nsl.com site.  I found the ray.k script.
The command R[3]32 runs without error on k3.2 and I was able to replicate the length error using Kona.

I see what you mean about not being able to tell where the length error occurs.
Will take a closer look at it over the next few days.

Tom Szczesny

unread,
Jan 3, 2014, 6:47:24 AM1/3/14
to kona...@googlegroups.com
As a very first cut of an admittedly "kludgy" improved script error reporting fix try tavmem/kona.git
It already has a file ray.k included, with the ray-tracer script functions.

The level of display is controlled by a global variable sdf (currently set to 1) near the top of the file kx.c
Setting sdf=0 turns off the display, sdf=2 provides full detail.

Z K sd(K a);
Z K sd_(K a,I f);
are cover functions (show detail) in kx.c for 
K show(K a);
located in k.c

Tom Szczesny

unread,
Jan 3, 2014, 9:03:04 PM1/3/14
to kona...@googlegroups.com
The "length" error is thrown in function: K flip(K a) in vg.c
There is a problem with the argument "a".
"a" is a list where a->n==1024.  
Each of the 1024 members should be a 2 element integer vector of the form (x,y) where both x and y run from 0 to 31.
However, the first 32 members are actually 1-element vectors of the form
,0
,1
,2 ...
The first integer of these 32 pairs (which should be 0) has been lost.

Bakul Shah

unread,
Jan 3, 2014, 9:40:21 PM1/3/14
to kona...@googlegroups.com
k has the single steping facility with \s which is useful.
What would be neat is a trace facility. Something like this:

$ gsi
> (load "chud.scm") ; chudnovsky brother's algorithm for n digits of pi
> (trace ch-split) ; trace functions ch-split & pi
> (trace pi)
> (pi 30)
| > (pi 30)
| | > (ch-split 0 4)
| | | > (ch-split 0 2)
| | | | > (ch-split 0 1)
| | | | (5 10939058860032000 -2793657715)
| | | | > (ch-split 1 2)
| | | | (231 87512470880256000 254994357387)
| | | (1155 957304069945956794936328192000000 -244479889433338740603253065)
| | | > (ch-split 2 4)
| | | | > (ch-split 2 3)
| | | | (1105 295354589220864000 -1822158051155)
| | | | > (ch-split 3 4)
| | | | (3059 700099767042048000 6711910799755)
| | | (3380195 206777679108326667706246889472000000 -1275692427127400265958...
| | (3904125225 19794911378438016137008628772369918382418040989294159462400...
| 3141592653589793238462643383279
3141592653589793238462643383279


Tom Szczesny

unread,
Jan 5, 2014, 2:50:46 PM1/5/14
to kona...@googlegroups.com
\s file
does a stepwise load (line-by-line) of a script file in k.
By "trace facility" you probably meant \x
where x is an expression in a function expression.  This is open issue #35.
Yes, I agree: this would be very useful in Kona to diagnose script problems.

Bakul Shah

unread,
Jan 5, 2014, 4:22:07 PM1/5/14
to kona...@googlegroups.com
\b t would be quite useful.
Though I was thinking of something that would also print the call, and not just the result. For example:

  f:{:[n < 2; n ; n * f[n-1]]}
  \T f  \\ trace function f
  f 3
| f 3
| | f[2]
| | | f[1]
| | | 1
| | 2
| 6
6

Tom Szczesny

unread,
Jan 18, 2014, 2:53:59 PM1/18/14
to kona...@googlegroups.com
Stevan -
One of the problems Kona has with the ray.k script is the unusual syntax for the function N, the 0 after the 1st set of brackets [n;o;i]0
N:{[n;o;i]0{x+T[(0 0 -4.;U(i+(y%4)-n%2),n);o;_sqrt 2^-42;0i,,3#0.]U -1 -3 2.}/+4_vs!16}

I could not find a description of the semantics of this syntax in my copy of the K reference manual.
Can you point me to a description?

BTW:  There is a thread of comments on Kona's problems with ray.k at kevinlawler/kona issue #228.

stevan apter

unread,
Jan 18, 2014, 3:04:03 PM1/18/14
to kona...@googlegroups.com
hi tom

so that's just initial value for 'over':

x f/y

i.e.,

 +/2,!6
17
 2+/!6
17

Tom Szczesny

unread,
Jan 18, 2014, 5:44:57 PM1/18/14
to kona...@googlegroups.com
Thanks !

Tom Szczesny

unread,
Mar 6, 2014, 10:11:31 AM3/6/14
to kona...@googlegroups.com
github.com/tavmem/nsl now contains a Kona script (Nray.k) that is a working Kona version of the nsl.com script ray.k.
See also issue #228 at github.com/kevinlawler/kona.
I do agree that Kona sorely needs additional script debug features (probably beginning with Stop / Trace).
Thanks !


To unsubscribe from this group and stop receiving emails from it, send an email to kona-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Kona Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kona-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages