Jack Ort wrote:
> Can anyone point me toward the best resource for learning s: ??
> I looked at the Vocab. description but got lost.
I don't think there has been much written up (publically) about symbols,
outside of the Vocabulary (maybe because there's not too much to say about
them). But Henry's J for C programmers does touch on them:
http://www.jsoftware.com/help/jforc/odds_and_ends.htm#_Toc191734566
BTW, if you haven't read JfC, it's definitely worth your time & effort.
Henry is a master tutor.
> But what if I want to see all my coded strings
Looking through the s: Voc entry, I was able to throw this together:
5 s: _6 s: i. 0 s: 0
This gives you a list of all the symbols you've encoded, in order (so symbol
1 is at index 1 in that list, symbol 2 is at index 2, etc). The first
symbol will always be a: (the empty symbol), and your user-entered symbols
will appear after that. If you don't care about the indices particularly,
and just want to take a quick glance at the table, you could skip the 5 s:
and just do _6 s: i. 0 s: 0 .
> Is there a way to view all of the code pairs?
If you really want to see the pairs, you could do (;&> 5 s: _6&s:) i. 0 s:
0 . But ....
> to find out if a string has been coded already
why do you want to do this? Whether a symbol has already been coded
shouldn't matter (should it?). When you use s: on a string, it will
return the symbol for that string, creating it if necessary. It won't hurt
to use s: on a string that's already been coded.
If you really want to know if a string's already been coded, I'd be
interested in hearing about your application / reasons.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm