After further thought (though perhaps still not enough time studying the code and thinking about its use), a better approach (than coinsert'base', which would allow name collisions) would be to use
do_base_ instead of ". where that is used (getDEoptim and packargs). Sadly, there's no equivalent workaround for ~ That said, we could define a verb to specify a default locale: inlocale=: (],'_','_',~[)^:(0='_'-:{:@])L:0~ 'f' inlocale 'base' f_base_ 'f_foo_' inlocale 'base' f_foo_ (<'f') inlocale 'base' +-------+ |f_base_| +-------+ And then deoptim could be updated with func=. func inlocale'base' This would require that historical usage of deoptim (which defined functions in pdeoptim) would have to be changed, but it would make casual use easier. I'm not sure this is needed in this example (is there any casual use of deoptim?), but this issue (documenting and handling locale issues) is one I think about way too often. -- Raul On Wed, May 11, 2022 at 11:00 PM Ric Sherlock <tikk...@gmail.com> wrote: > > Hi David, > Thanks for the feedback. I agree that adding some additional text there may > help users trying to work out how to use the addon. Did you have a > suggested wording change in mind? > > The function named will be called from within the 'pdeoptim' locale and so > needs to either be in the search path of pdeoptim or called from its > explicit location (which may or may not be in 'base'). > > The examples in the test folder all append the locale of the desired > function to the name to ensure that it is found. There may be a better > solution, but when I wrote the addon that was what I came up with! > > Thanks, > > > > > > On Thu, May 12, 2022 at 2:35 AM David Lambert <b49p23t...@gmail.com> wrote: > > > Suggestion: please amend the comment section to explicitly state that > > func include locale. It now reads > > > > NB.-y: 2-item list of boxed arguments > > NB.- 0{ func - String naming a function f(x,y) to minimize, with > > first argument > > NB.- the vector of variables over which minimization is to > > take place. > > NB.- It should return a scalar result. Empty values are not > > allowed. > > > > Thank you, David Lambert > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm