Justin Paston-Cooper asked:
> How can I stipulate that map_jmf_ map a
> file to a variable in a given locale or
> to a member of an object?
For absolute locatives, pretty much the way you'd expect; use map_jmf_
'FOO_locale_'; ... . In fact, when you write map_jmf_ 'FOO' you are
actually exercising JMF's exceptional case handler, where it is forced to
elect _base_ for you [1] .
For relative locatives (members of objects), convert them to absolute
locatives, then proceed as above (right now, fullname_jmf_ doesn't support
indirect locatives; this could be remedied [2]).
-Dan
[1] Every J name is explicitly in a locale; there is no "default" locale,
but the Dictionary does admit the synonym name__ for name_base_ :
http://www.jsoftware.com/help/dictionary/dicti.htm
Following in this tradition, JMF defaults unqualified names to _base_ (the
only other reasonable option, _z_, is undesirable because that locale is
supposed to be the global library for reusable names, whereas base is
normally used as the "default workspace", and more often holds large nouns):
load'jmf'
fullname_jmf_
3 : 0
t=. y-.' '
t,('_'~:{:t)#'_base_'
)
NB.
http://www.jsoftware.com/trac/base/browser/branches/cdb/api/mapped/util.ijs#
L43
Put another way, JMF operates through J's symbol table mechanisms, and
symbol tables are mapped 1:1 to locales in J.
[2] With the definition:
fullname_jmf_ =: fullname_jmf_ f.@:>@:([: (, 2 (1 |. {. (;@:; ".)
}.) ])&.>/ ] <;.1~ 1: 0} [: </\ 1 0 0 E. '__'&E.)
indirect locatives should be converted to direct locatives, and direct
locatives & unqualified names will be left untouched, before being passed to
(today's definition of) fullname_jmf_ . This definition should also work
as an interim workaround until JSoftware includes its substance in the
standard distribution.
Warning: I haven't tested it much.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm