possible problem with conew or me

22 views
Skip to first unread message

Thomas McGuire

unread,
Jun 29, 2025, 4:49:19 AM6/29/25
to fo...@jsoftware.com
The encoder code from picoGPT-in-j has the following statement for creating an instance of the encoder:

encoder =: MODELS_DIR conew ‘encoder'


If I run this line there is the usual progress messages and it completes. Now when I look a what encoder is storing I see:


encoder

┌─┐

│0│

└─┘



I can now use the functions in the encoder object as follows:


encode__encoder each 4 {. storylist


this will work and I will get back the expected lists of integers


Now when I try to set up a locale for the regex library and I use the following:


rgx =: conew ‘jregex’

rgx

┌─┐

│2│

└─┘


and then if I try to compile a pattern with the locale: phandle =: rxcomp__rgx pat J crashes.


However if I use this form:


rgx =: 0&".@> conew ‘jregex’

rgx

3


the phandle =: rxcomp__rgx pat will work as expected


The only differences I detect is that the encoder code has create and destroy code, the regex code does not. Because of the create verb the encoder conew involves a parameter, where the regex code does not have a parameter.


Not sure why there is a difference except that the encoder code was written to be object oriented but the regex code was not.



Tom McGuire

Henry Rich

unread,
Jun 29, 2025, 11:10:54 AM6/29/25
to fo...@jsoftware.com
Integer locale#s should be equivalent to the boxed numeric strings, except a little faster.  I cannot replicate the problem you report on Windows.  Can you give a script that crashes, starting from a clean J session?

Henry Rich
To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Reply all
Reply to author
Forward
0 new messages