If the code in the string is altering the content of the string, you get 
non-von Neuman programming, with (sometimes) very neat
consequences.
Powerful, yes, but equally dangerous and sometimes even hardly predictable.


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [email protected] 
> [mailto:[email protected]] Namens Marshall
> Lochbaum
> Verzonden: zondag 22 juli 2012 22:05
> Aan: [email protected]
> Onderwerp: Re: [Jprogramming] Verbs that contain nouns
> 
> There is, in fact. Simply execute the name you want to evaluate:
> g =. ] >@{ ".@:('paths'"_)
> 'paths'"_ is the verb that always returns the string 'paths', so
> ".@:('paths'"_) is the verb that always returns the current value of
> paths.
> The "strings are code" mentality feels ugly to someone used to C or
> Lisp, but it's very powerful and worth learning.
> 
> Marshall
> 
> On Sun, Jul 22, 2012 at 07:51:17PM +0100, David Vaughan wrote:
> > Thanks.
> >
> > So there's no way to achieve it with a tacit verb?
> >
> > On 22 Jul 2012, at 18:48, Ric Sherlock wrote:
> >
> > > When you assign a Tacit verb to a name the value of the nouns in the
> > > definition are "compiled" in to the tacit definition. If you use an
> > > explicit definition the noun will be reevaluate d each time.
> > > On Jul 22, 2012 1:32 PM, "David Vaughan" <[email protected]> wrote:
> > >
> > >> I have a noun called paths, whose value changes at various points, and a
> > >> verb g that uses paths. The problem is, it only works for the initial 
> > >> value
> > >> of paths.
> > >>
> > >>   paths =: \:~&.> (;~ 0$0) , <\ 2+i.7
> > >>   paths
> > >>
> ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
> ?????????????????????????????????????????????????????????????
> > >> ?????????2???3 2???4 3 2???5 4 3 2???6 5 4 3 2???7 6 5 4 3 2???8 7 6 5 4 
> > >> 3 2???
> > >>
> ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
> ?????????????????????????????????????????????????????????????
> > >>   g =. >@{&paths
> > >>   g
> > >>> @{&((0$0);(0$0);(,2);3 2;4 3 2;5 4 3 2;6 5 4 3 2;7 6 5 4 3 2;8 7 6 5 4 3
> > >> 2)
> > >>
> > >> So now when paths changes, g becomes useless.
> > >>
> > >> My question is how can I get g to always check the value of paths when it
> > >> is executed? And more generally, how can the name of a noun rather than 
> > >> the
> > >> value of the noun be used in a verb?
> > >>
> > >> Many thanks.
> > >> ----------------------------------------------------------------------
> > >> 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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to