Closed ErikSchierboom closed 4 months ago
Currently commuting. I suggest refractoring the anon until you've got it working then, in you must, merge it back in as an anon.
Well it is stack hygiene, but I don't think it's the r-stack that's causing it, otherwise the other tests would fail too.
Just needs a rebase now?
I've rebased. I think there might be a bug somewhere in 8th.
( 5 ' n:= a:indexof nip number? nip )
That works, but:
( 5 ' n:= a:indexof nip null? not nip )
doesn't.
Well if you can demonstrate it, take it to the Problems board and report it. Ron's very quick on support.
ok> help a:exists?
a:exists?
SED: a n -- a T
Returns true if there is a value defined for the index n in the array. This is necessary because requesting an arbitrary index
from an array will always succeed, returning null if the index does not exist as well as if the value stored is actually null. If
the index is negative, it is taken as that many from the end.
Well if you can demonstrate it, take it to the Problems board and report it. Ron's very quick on support.
I'll try and do a repro sometime this week.
ok> help a:exists?
@axtens That's a different thing though, that is checking for an index, not a value.
I've rebased. I think there might be a bug somewhere in 8th.
( 5 ' n:= a:indexof nip number? nip )
That works, but:
( 5 ' n:= a:indexof nip null? not nip )
doesn't.
Let me get this straight: the first nip
is to remove the array from the stack; the second nip
is to remove either the index or the null; leaving just the boolean result of the presence of 5 in the array.
But I see what you mean. Using null? not
gives
PANIC: expected stack depth to be 2
Stack is:
0 a: 00007f653edb2500 2 [1,2,3]
1 a: 00007f653edb2840 1 []
2 a: 00007f653edb2700 1 [ [5,5,5], [5,1,2], [1,5,2], [1,2,5]]
3 s: 00007f653f03cbf0 1 keeps lists
Where is that empty array coming from?
Oh, got it. the word null?
is defined both in the 8th global namespace and the exercism/test namespace
Use G:null? not
@axtens @glennj The nested lists test cases fail. I've checked the anonymous word being used there but it looks okay to me. What am I missing?