Thank you all for your kind replies! And to those saying how I should
really use awk for this job- I know, I was just curious! I am very
impressed by the variance in answers, and how different J really is
compared to other languages.

Thanks again,

Lee

P.S. As for the input, just numbers was fine. I'm curious though what
J does when it encounters strings (and numbers!). I figured reading
through the books offered on the wiki will explain this. (+/ "hello"
"world" 100 = what? :)

On Sat, Feb 15, 2014 at 10:20 AM, Jim Russell <jimsruss...@yahoo.com> wrote:
> I love AWK; it (and perl) have saved my bacon many times. If your problem 
> involves processing fields within lines of an I/O stream in a *nix 
> environment, of course you or I should use AWK. Particularly me, since I'd 
> never be given a processing task involving more math than a "gozinta" or 
> takeaway, much less anything involving polynomials, natural logs, verb 
> inverses, factorials, ranks above 3, and a whole bunch of stuff that J would 
> do for me if only I understood what it was.
>
> (I would also pick AWK if I had only 5 minutes to learn a new language.)
>
> But had AWK never been invented (shudder), and I needed to write it, would I 
> use J? Well, not me, but I know some folks here that might knock it out using 
> J in an afternoon or two.
>
>> On Feb 14, 2014, at 9:51 PM, Lee Fallat <ircsurfe...@gmail.com> wrote:
>>
>> Hey there,
>>
>> As new user to J (but several years experience with C and Java), I
>> find it very, very interesting. The power of its one liners and
>> mathematical heritage really have me hooked.  I was wondering though
>> if it has similar capabilities as awk. What's the equivalent to this
>> awk script in J?:
>>
>> BEGIN { FS=";" }
>> { print $1+$2 }
>>
>> This script sets a FieldSeparator to ;, and then for every "row", add
>> the first and second column and prints it. I would like to replace awk
>> with J!
>>
>> Thank you,
>>
>> Lee
>>
>> P.S. Excuse me if I've misidentified J sentences. (Sentences -> statements?)
>> ----------------------------------------------------------------------
>> 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