Hi Bill,

It works. 

   [temp=. '{. ~.'
{. ~.
   [data=. < every 1 2 3 1 2 3
+-+-+-+-+-+-+
|1|2|3|1|2|3|
+-+-+-+-+-+-+
   3 : (temp, ' y') data
+-+
|1|
+-+
   
Thanks. I'll use this one over my createCMD verb. ;)

r/Alex

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of bill lam
Sent: Monday, March 23, 2009 4:16 PM
To: [email protected]
Subject: Re: [Jprogramming] Executing a string command

On Mon, 23 Mar 2009, Alex Rufon wrote:
> Wow, it took some time for me to get back to this but I think I figured it 
> out.
> 
> So instead of using evoke ... I used 0!:0 like so:
> 
> NB. =========================================================
> NB.*createCMD (v) creates a temporary verb with a J sentence string
> NB. 
> NB. y is: a string J sentence
> NB. creates a GLOBAL variable eoeCMD
> createCMD=: verb define
> temp=. 'eoeCMD=: 3 : ''', y, ' y'''
> 0!:0 temp
> )
> 
>    createCMD '{. ~.'
>    eoeCMD ;: 'aa bb cc aa bb cc aa bb'
> +--+
> |aa|
> +--+
> 
>    createCMD '+/' 
>    eoeCMD i. 5 5
> 50 55 60 65 70

I'm not sure why createcmd is needed, eg, you can just write
   3 : '{. ~. y' 'aa bb cc aa bb cc aa bb'
   3 : '+/ y' i. 5 5
or
   cmd=. '{. ~.'
   3 : (cmd, ' y') 'aa bb cc aa bb cc aa bb'

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩113 杜甫  旅夜書懷
    細草微風岸  危檣獨夜舟  星垂平野闊  月湧大江流
    名豈文章著  官應老病休  飄飄何所似  天地一沙鷗
----------------------------------------------------------------------
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