I was just practicing "going backwards" this morning and look what I got!
f=: (A=:$ -. 1:) ($,) ]
g=: 13 :'(($y)-. 1:y)$,y '
f
($ -. 1:) ($ ,) ]
g
, $~ $ -. 1:
Linda
-Original Message-
From: [email protected]
[mailto:[email protected]
Turning it around is easier to read, and shorter;)
h=: ($-.1:)$,
$ h 3 1 4 1 5 9 $ 'abc'
3 4 5 9
greg
~krsnadas.org
--
from: Linda Alvord
to: [email protected]
date: 8 May 2014 01:58
subject: Re: [Jprogramming] Remove 1s from shapes
I was just practicing "going backwards" this m
nice...
$ (($ -. 1:) ($ ,) ]) 1 6 1 1 $ 1
6
- Original Message -
From: Linda Alvord
To: [email protected]
Cc:
Sent: Thursday, May 8, 2014 4:58:18 AM
Subject: Re: [Jprogramming] Remove 1s from shapes
I was just practicing "going backwards" this morning and look what I
Pepe
>One gets rid of the gMail "feature" by preceding everything one wants to keep
>in one line with a >
>It is true that someone down the line does not know this trick and allows
>their MUA to willy nilly put >'s before many broken up lines. But as the
>practice spreads the vagaries of machi
cperm =: [: , [: < "1 [: > [: ,"0 1/ each/ (_2&}. , [: ,"0 0/ each/ _2&{.)
this creates constrained permutations where each position in the list can only
be drawn from its own set:
cperm 3 4 ; 1 2
┌───┬───┬───┬───┐
│3 1│3 2│4 1│4 2│
└───┴───┴───┴───┘
cperm 0 ; 3 4 ; 1 2; 5
┌───┬─
Try: {x. e.g.
{ 8 9;0;3 4;1 2;5
┌─┬─┐
│8 0 3 1 5│8 0 3 2 5│
├─┼─┤
│8 0 4 1 5│8 0 4 2 5│
└─┴─┘
┌─┬─┐
│9 0 3 1 5│9 0 3 2 5│
├─┼─┤
│9 0 4 1 5│9 0 4 2 5│
└─┴─┘
cperm 8 9;0;3 4;1 2;5
┌─┬─
thank you Roger. Learning the vocabulary my own slow way :P
- Original Message -
From: Roger Hui
To: Programming forum
Cc:
Sent: Thursday, May 8, 2014 1:58:04 PM
Subject: Re: [Jprogramming] a cool permutation verb
Try: {x. e.g.
{ 8 9;0;3 4;1 2;5
┌─┬─┐
│8 0 3 1 5│8
Indeed cool, does it differ from ,@{ :[:
Date: Thu, 8 May 2014 10:53:53 -0700 (PDT)
From: "'Pascal Jasmin' via Programming"
To: Programming forum
Subject: [Jprogramming] a cool permutation verb
Message-ID:
<[email protected]>
Content-Type: text/pla
Its the same. Just more descriptive name than catalogue perhaps. Google seems
to only find J references to query "catalogue function permutations". I feel
as though catalogue and my use of it is a generalizable pattern, and the J
designers agreed, but I don't know if other languages did somet
Catalog was invented in "Dictionary APL" and was called "all".
http://www.jsoftware.com/papers/APLDictionary.htm It's what you need to
index rectangular arrays using the more primitive notion of indexing a
vector by an array of integers.
On Thu, May 8, 2014 at 2:34 PM, 'Pascal Jasmin' via Progr
I don't see catalog used frequently in natural J code. It does come up on these
Forums from time to time, mostly in contrived situations. In my own code, I
sometimes use it to generate J sentences in order to compare performance
statistics for semantically-equivalent phrases. But outside of that
A=: 1 2 3 10 100 987654321x
B=: 1+{:A
C=: B#.A
B #.inv C
|nonce error
| B#.inv C
Hypothetically speaking, we want something that can find A, given B and C.
Perhaps
A-:((>.B^.C)#B)#:C
1
or
A-:B (((<.@%~,|){.),}.@])^:(<: {.)^:_ C
1
I ran into this while playing with
http
> one reason for its rarity is, at least, that in any real-world context, a
> complete MxN catalog would be prohibitively expensive
its very cheap compared to A. and filtering permutations after you've generated
them. In the resource matching application I linked to, where 1 user ends up
with
I imagine this has been discussed before, if so please feel free to point
me to relevant link.
Suppose I have a unicode string - I can enter it directly at the terminal -
and I want to box it. E.g.
;/ 7&u: 'κυάμων-απέχεσθαι'
+--+--+--+--+--+--+-+--+--+--+--+--+--+--+--+--+
|κ|υ|ά|μ|ω|ν|-|α
See recent thread on this topic:
http://www.jsoftware.com/pipermail/programming/2014-April/036885.html
On Fri, May 9, 2014 at 3:21 AM, alexgian wrote:
> I imagine this has been discussed before, if so please feel free to point
> me to relevant link.
>
> Suppose I have a unicode string - I can e
Use format/sbox from standard addons for correct Unicode box display.
On Fri, May 9, 2014 at 4:21 AM, alexgian wrote:
> I imagine this has been discussed before, if so please feel free to point
> me to relevant link.
>
> Suppose I have a unicode string - I can enter it directly at the terminal
I want to get the (base 10) digits of an integer as an array.
e.g. 2343 becomes an array 2 3 4 3
My attempt is:
tens =. 10 $ 10 tens #: 345
result: 0 0 0 0 0 0 0 3 4 5
I created the initial array tens as a 10 element array, and f course now I have
way too many leading zeros in my result.
How
10.^:_1 ]314159
3 1 4 1 5 9
Alternatively:
ndigits=: 1 + [: <. [ ^. 1 >. ]
10 ndigits 314159
6
(10 $~ 10 ndigits 314159)#: 314159
3 1 4 1 5 9
digits=: ([ $~ ndigits) #: ]
10 digits 314159
3 1 4 1 5 9
16 digits 314159
4 12 11 2 15
On Thu, May 8, 2014 at 11:33 PM, Jon H
18 matches
Mail list logo