A bit of an explanation to the answer

    ":"0 i.4
0
1
2
3

converts numbers to text representation. 

'm'(,":)"0  i.4


or

 'm' ,"0 1 ": "0  i.4


will provide the same answer Raul gave.


----- Original Message -----
From: Raul Miller <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Friday, February 7, 2014 5:46:37 PM
Subject: Re: [Jprogramming] k's for each, for each left, for each right in j

' would be either "0 (or equivalently "+) or &.>
f'x would be either f"0 x (or equivalently f"+ x) for flat x or f&.> x
(or, equivalently f each x) for running f inside boxes of x

And I think you want 'm'&,@":"0 i.4 though there are other ways of
accomplishing that. J is not exactly equivalent to K and you'll need a
bit of study to get used to it.

I hope this helps,

-- 
Raul


On Fri, Feb 7, 2014 at 5:41 PM, Christopher A. Simon
<[email protected]> wrote:
> Sorry about lack of explanation,
>
> ' is for each.
>
> f'x is function f applied to each value of x,
>
> !4 in k is the same as i.4 in j
>
> monadic $ converts or casts to type char
>
> and , is append.
>
> ("m",)'$!4, could also be {[x]"m",x}'$!4
>
> results in,
>
> ("m0"
>  "m1"
>  "m2"
>  "m3")
>
> What I'm having trouble translating are some of the loopless operations in
> j.
>
> I think I have a basic handle on some of the vectorized operations, like
>
> 1 2 * 3 4
>
> or
>
> +/i.5   "insert '+' into 0 1 2 3 4" right?
>
> But if I want to define a function, say append the character "m", and then
> use the defined function in a vectorized fashion, I get a little lost.
>
> Thanks,
>
> -Chris
>
>
>
>
>
>
>
> On Fri, Feb 7, 2014 at 4:56 PM, Raul Miller <[email protected]> wrote:
>
>> I do not know exactly what ' \: and /: do in K - if I recall
>> correctly, these are somewhat like rank specifications ("0) ("1 0) and
>> ("0 1) except maybe use _ in place of 1 depending on what you want to
>> do, and somewhat like the use of each (&.>) and possibly boxing either
>> the left or right argument.
>>
>> It might be easier if you expressed the problem you are trying to
>> solve in English, or if you could point at the relevant K
>> documentation. I can't find enough on ("m",)'$!4 in documenation I can
>> find -- stuff like http://www.kx.com/q/d/primer.htm or
>> http://code.kx.com/wiki/Reference/BangSymbol or
>> http://code.kx.com/wiki/Reference/DollarSign -- to say anything useful
>> about that expression.
>>
>> Thanks,
>>
>> --
>> Raul
>>
>> On Fri, Feb 7, 2014 at 4:46 PM, Christopher A. Simon
>> <[email protected]> wrote:
>> > My apologies if this is not where newbies email with questions.
>> >
>> > I've become somewhat comfortable with k, in particular
>> >
>> > ' \: and /:
>> >
>> > But I haven't exactly found how to do similar operations j.
>> >
>> > I'm a little lost with, find the equivalent to,
>> >
>> > ("m",)'$!4
>> >
>> > Any suggestions for transitioning from k to j, with respect to ' , \:
>> and /:
>> >
>> > Thanks,
>> >
>> > -Chris
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> --
> __________________________________________
>
> Christopher Alex Simon
> __________________________________________
>
> (831) 239 0636
>
> 113 Cedar Apt 5A
>
> New York, New York 10006, USA

> ----------------------------------------------------------------------
> 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