Re: [Jprogramming] sorting using verb returing a boolean

2023-12-21 Thread 'Pascal Jasmin' via Programming
The same output of your quoted "program" \:~ _10 1 10 20 _30 15 25 30 0 30 25 20 15 10 1 0 _10 _30 I may have misunderstood your original question, based on subject line.  You appear to want to sort card hands. You would want to encode cards as integers, where 2-A maps to 0-13.  It is a good

Re: [Jprogramming] sorting using verb returing a boolean

2023-12-21 Thread 'Pascal Jasmin' via Programming
1 0 0 1 0 /:~ i.5 1 2 4 0 3 On Thursday, December 21, 2023 at 09:03:34 a.m. EST, 'Viktor Grigorov' via Programming wrote: Hey, Is there an easy way to sort an array with verb  returning either 0 or 1, like the comparison primitives? The verb that I'd in mind relates to the 2023'

Re: [Jprogramming] Primes with combination of same digits

2023-09-23 Thread 'Pascal Jasmin' via Programming
pf 19 has at least 1 solution # 1 ,^:(0 = 1&p:@:(10&#.)@])(^:100) 1 1 1 19 1 p: 111x 1 On Saturday, September 23, 2023 at 01:18:44 p.m. EDT, 'Pascal Jasmin' via Programming wrote: there is a bug in your p 3... 793 is not prime. An approach that ca

Re: [Jprogramming] Primes with combination of same digits

2023-09-23 Thread 'Pascal Jasmin' via Programming
there is a bug in your p 3... 793 is not prime. An approach that can be improved upon in speed: perm =: i.@! A. i. raveltillCS =: 1 : ',/^:(m < #@$)^:_' NB. repeat ravel until count of shape = m p2 =: 1 3 7 9 ~.@:(,/^:(2 < #@$)^:_@:(/:~"1@:({ )~&:>)) (<0 1 2 3) { @:#~ ]  NB. unique combination

Re: [Jprogramming] Interesting Quora Problem:

2023-09-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
3 at 02:30:11 p.m. EDT, Jo van Schalkwyk wrote: You do know that (>:i.9) can be replaced by 1 3 7 9, because there are just 4 even digits and 4 places for them, so the rest must be odd (and 5 is taken)? Dr Jo. On Thu, 14 Sept 2023 at 04:14, 'Pascal Jasmin' via Programming < progr

Re: [Jprogramming] Interesting Quora Problem:

2023-09-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
to test a / version v2 =: ([ (] #~ [ = 10&#.inv(#@~."1@:)@]) [ (] #~ 0 = |) (BASE10DIVbyINDEX {::~ [) +("1 0)(,@:) 10 * ]) 10 timespacex 'v2/ 9 8 7 6 5 4 3 2 1 0' 0.00013159 14496 One conclusion is that a single large filtering operation is more time efficient t

Re: [Jprogramming] Interesting Quora Problem:

2023-09-12 Thread &#x27;Pascal Jasmin&#x27; via Programming
lower code version, of Raul's. I may not have understood problem, but I get 2492 solutions (oops... now I understand that each digit needs to be used just once. I =: ]F.: NB. insert using fold for shape flexibility #(>:i.9) ([ (] #~ 0 = |) (i.10) +("1 0)(,@:) 10 * ])I 9 8 7 6 5 4 3 2  # (>:i.9

Re: [Jprogramming] integers occur in integers?

2023-08-26 Thread &#x27;Pascal Jasmin&#x27; via Programming
3 2 1(*./@:(e.~)&~.&(/:~) 10&#. inv)("1 0) 230 123 111 123123132 0 1 1 1 On Saturday, August 26, 2023 at 06:31:01 a.m. EDT, Richard Donovan wrote: I am trying to find out whether a series of integers y only contain a set of integers x That is,        1 3 5 verb 5311 10531 536

Re: [Jprogramming] Anagram Operator (A.) and Generalized Datatype declaration in function assignments.

2023-08-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
if you (or a user) are calling your function from J code, add the x to any "literal numbers". If your very large number is the result of a calculation, then you can ensure that it is returned as extended. If the input comes from elsewhere/other program, then pass it as a string. ".@,&'x' '1239

Re: [Jprogramming] Explicit to tacit conversion without repeating verbs

2023-08-10 Thread &#x27;Pascal Jasmin&#x27; via Programming
A general version of approach 1 is to append any temporary results to original argument in boxed form. G0 =: 0 {:: ] G1 =: 1 {:: ]G2 =: 2 {:: ] [:  (G2 V~ G1 U G0 )  [ ( [ (] (,<)~ W) G1) ] ,&< Q Can be streamlined a bit with: NB. keeps y argument, though ensures it is boxed, and appends resul

Re: [Jprogramming] Filling in Missing Parts of a Sequence

2023-07-24 Thread &#x27;Pascal Jasmin&#x27; via Programming
I have a kv library, I published before. It includes (kvinsert) an ordered insert function to permit arbitrary order, but its design and testing may need improvement.  In this case, it seems that appending then sorting represents the order that you want.  In kv library append also updates when

Re: [Jprogramming] Question

2023-07-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
Not sure it is supported, however, You can paste in a script into edit window, and you could paste the content of an aribitray file into a 0 : 0 multiline noun defintion. On Tuesday, July 11, 2023 at 01:50:10 p.m. EDT, 'robert therriault' via Programming wrote: Hi charles, The 'J Play

Re: [Jprogramming] how to apply the same adverb repeatedly ?

2023-06-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
my version of this with new 903 trains, eval_z_ =: 1 : 'if. 2 ~: 3!:0 m do. m else. a: 1 : m end.' NB.1 : ' a: 1 : m' isNoun =: (0 = 4!:0 ::0:)@:< aar =: 1 : 'if. isNoun ''u'' do. q =. m eval else. q =. u end. 5!:1 < ''q'' ' vm2c =: APPLY =: 2 : ' u n' NB. verb to monad applied to n  9 (((&#) vm2

Re: [Jprogramming] Fwd: Adverb in parsing table

2023-06-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
I'll just add,  for the adverbs that return verbs, and / is a good example. The monadic case of u/ uses a dyadic u to insert u into arguments of the "resulting verb" u/ For dyadic/table case of /  it is [x] u/ y, the presence of x that applies the dyadic case to the u/ resulting verb. It is note

Re: [Jprogramming] Multiline comment

2023-05-24 Thread &#x27;Pascal Jasmin&#x27; via Programming
Note 'title'comment line 2comment line 3 ) On Wednesday, May 24, 2023 at 06:37:29 a.m. EDT, 'Rob B' via Programming wrote: Hi, A few days ago I thought I saw something about multiline comments eg NB. 1….. I cannot find anything about it now, was it a dream? Regards, Rob. ---

Re: [Jprogramming] sequential machine and empty word output

2023-04-24 Thread &#x27;Pascal Jasmin&#x27; via Programming
> parsing a csv file with 3 fields per record where any can be empty: This is indeed an important application, and missing capability of ;:. discussion: https://code.jsoftware.com/wiki/User:Pascal_Jasmin/sequential_machine_intro  A workaround to emit nulls part of jpp package (whole project m

Re: [Jprogramming] Problem with integer arithmetic

2023-04-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
> Example: 5 % m. 7 (9) gives 5 *(mod 7) (inverse of 9(mod 7)) example is not clear to me: is 5 % m. 7 (9) 7 | 5 % 9  NB.? I don't understand % as a typical application of modular arithmetic.   On Monday, April 17, 2023 at 02:56:28 p.m. EDT, Henry Rich wrote: In the next beta u m. n me

Re: [Jprogramming] distance makes the heart grow fonder

2023-04-02 Thread &#x27;Pascal Jasmin&#x27; via Programming
label_. currently serves line splitting function in explicit code.  Shortening that to .. equivalent "is easy". functionality that would appeal to me from a "special word" (not conj/adv or other speech) is as a separator that acts as parentheses, and works with tacit code: myfunction =: exp1 ..

Re: [Jprogramming] Applying a cyclic gerund

2023-02-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
there is G1 =: 1 {:: ] G0 =: 0 {:: ] (G0 ; ".@G1) 'abc';'13.2' On Tuesday, February 21, 2023 at 11:18:21 p.m. EST, Elijah Stone wrote: Your routine most likely doesn't do what you want it to:     'abc ' -: 0{:: (<@:])`(<@:".)"1 >'abc';'13.2' 1 The 'abc' got padded when you opened.

Re: [Jprogramming] Odd

2023-02-16 Thread &#x27;Pascal Jasmin&#x27; via Programming
There is also a numeric library install required (forget which one) that while it shouldn't crash without it, will not produce extended results. On Thursday, February 16, 2023 at 10:31:45 p.m. EST, bill lam wrote: We have received reports on the crash but can't reproduce by ourselves

Re: [Jprogramming] Atop parsing

2023-02-16 Thread &#x27;Pascal Jasmin&#x27; via Programming
Beautiful. this is the CC(nv) pattern, that matches the CA pattern. The elegance that allows that allows for elegance in making "compounder" modifiers. On Thursday, February 16, 2023 at 12:28:24 p.m. EST, David Lambert wrote: Of the new modifier trains, I've found ^:^:_ as "while". 

Re: [Jprogramming] Atop parsing

2023-02-15 Thread &#x27;Pascal Jasmin&#x27; via Programming
fortunately the material written there is too advanced for a Journeyman > like me. I couldn't find any J book/pdf that talks about it in a more > digestible way ... and the j wiki only has this page. > > But I'm really excited about this discovery. > > thank you. >

Re: [Jprogramming] Atop parsing

2023-02-12 Thread &#x27;Pascal Jasmin&#x27; via Programming
All conjunctions including @ bind to their right argument "tightly" meaning just the one token. The left argument of conjunctions/adverbs is the entire verb phrase to the left of it. myvarp1 uses "linear style" even if it is tacit.  `[:`  has "no binding"  everything to right will execute firs

[Jprogramming] n: adverb proposal (and alternatives)

2023-01-18 Thread &#x27;Pascal Jasmin&#x27; via Programming
u n:  is to be => ([x] u y) this happens to be the same output as the verb u. u n: A is to be=> ([x] u y) A Difference between left and right is that left is a contained function that (u n:) can be considered a conjunction where x and y are m and n parameters.  Except that an actual conjunctio

Re: [Jprogramming] Closures; WAS: Verbs returning verbs

2023-01-18 Thread &#x27;Pascal Jasmin&#x27; via Programming
there is something like, f=. {{   a=. 5   b=. 6   g=. (a;b) {{ ... [ 'a b' =. m  }}   g=. a {{ ... m ... }}  NB. if fewer parameters transferred.   a=. 7 }} On Tuesday, January 17, 2023 at 10:58:05 p.m. EST, Elijah Stone wrote: Basically, yes.  It's interesting that you refer to them t

Re: [Jprogramming] Verbs returning verbs

2023-01-18 Thread &#x27;Pascal Jasmin&#x27; via Programming
n on, by some in the J community -- It seems that they're "too powerful". But if the problem is that explicit definitions are insufficiently constrained, why should we want to burden tacit definitions with this defect? -- Raul On Wed, Jan 18, 2023 at 12:40 AM 'Pascal Jasmin'

Re: [Jprogramming] Verbs returning verbs

2023-01-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
at having verbs return non-nouns is not the way to do it. Henry Rich On 1/17/2023 10:10 PM, 'Pascal Jasmin' via Programming wrote: > More ways to generate ARs doesn't hurt, but its not verbs returning > non-nouns, or a path (n:) to obtain non-nouns from a verb phrase, so then

Re: [Jprogramming] Verbs returning verbs

2023-01-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
More ways to generate ARs doesn't hurt, but its not verbs returning non-nouns, or a path (n:) to obtain non-nouns from a verb phrase, so then the proposal is not meeting a major need. repeating definitions, eval_z_ =: 1 : 'if. 2 ~: 3!:0 m do. m else. a: 1 : m end.' NB.1 : ' a: 1 : m' isNoun_z_

Re: [Jprogramming] Closures; WAS: Verbs returning verbs

2023-01-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
Could this be called templating? > (f%#) &:: ('f';+/`'') becomes +/%#. what if f were already defined?  (usually substituted in verb phrases) adverbs and conjunctions give this functionality. I'm happy with the templating engine in this thread http://www.jsoftware.com/pipermail/programming/20

Re: [Jprogramming] Verbs returning verbs

2023-01-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
ier. Henry Rich On 1/17/2023 3:12 PM, 'Pascal Jasmin' via Programming wrote: > so an =: arnoun > > an =: 1 : '<@:((,''0'') ,&< ]) m' NB. atomic rep of noun as an adverb (right > arg) > > eval_z_ =: 1 : 'if. 2 ~: 3!:0 m do. m

Re: [Jprogramming] Verbs returning verbs

2023-01-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
;nouns" and verbs.  It is not the inability to create ars. On Tuesday, January 17, 2023 at 12:13:21 p.m. EST, Henry Rich wrote: Please confine this to my proposal - not including n: . It seems to me that if ". can produce any part of speech, and can be applied to ARs, it c

Re: [Jprogramming] Verbs returning verbs

2023-01-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
The proposal for u n: ->  [x] u y  (and then u n: M => (([x] u y)M)  ) would work with this so that ". n: `:6 can consume "the output" though 2. suggests doing this.  Would: ". '+';'/'; '1 2 3' produce 3 boxes?  a linear expression? > willing to use dangerous backdoor hacks into JE to achiev

Re: [Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-14 Thread &#x27;Pascal Jasmin&#x27; via Programming
he same as (f g h)(u@:) is true, but coincidence, and I don't see what it > has > to do with anything. > > On Sat, 14 Jan 2023, 'Pascal Jasmin' via Programming wrote: > >> Raul expressed by thinking, >> >> .> x (f g n:A h) y  would be same as (f g

Re: [Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
#x27;now') a while ago, and >> > received >> > a lukewarm response.  I don't think it can be implemented other than as a >> > primitive.  (And I still think it would be a good idea to have.) >> > >> > Your solution which quotes the modifier

Re: [Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
wing? > > (u r2m) C v > > u C (v r2m) > > (u r2m) C (v r2m) > > You can't, so you would need a separate form for each. > > On Fri, 13 Jan 2023, 'Pascal Jasmin' via Programming wrote: > >> X =: 1 : 'm&+' >> >> >&

Re: [Jprogramming] (A n) new train. was: more fun with parallelism

2023-01-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
tedbyitemD')) ATTRIB (0 _1 _2 _3 _4) 2 minus@:minus nATTRIB 2 iotaA 5  NB. minus@minus reverts to sorted (P(<;._1 ' unique uniquebyitem sorted sortedbyitem')) ATTRIB (0 1 2 3 4) (minus 2 minus 2 iotaA 5)nATTRIB1 NB. use core adverb (nATTRIB1 ) to transform linear code res

Re: [Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
k=: aar(0:`)(,^:) oa =: 1 :'u Cloak @:' NB. apply quoted adverb after result. Can produce modifier     + 'X' oa 32 32&+ 2 (+ 'X' oa) 32 34&+ 2 + ('X' oa) 32 34&+ On Friday, January 13, 2023 at 11:19:49 a.m. EST, 'Pascal Jasmin' v

[Jprogramming] best/any way to get verb result to m argument of modifier?

2023-01-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
X =: 1 : 'm&+' What definition of r2m (result to m argument) below would allow X to see the result of + y (or x+y) as its m argument? + r2m X 3 purpose would be for X to produce a modifier from application of "verb".  Requirement is only that y argument (3 above) is outside any verb phrase.

Re: [Jprogramming] (A n) new train. was: more fun with parallelism

2023-01-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
> But I would favor such primitives – building corresponding > conjunctions should be fairly easy and might even be done > for all currently known decorations in a script distributed > but not loaded by default. > But maybe I missed a point why that new train actually > improves

Re: [Jprogramming] more fun with parallelism

2023-01-10 Thread &#x27;Pascal Jasmin&#x27; via Programming
tes as literal string, u P:'a' could return a boolean whether u is associative or not). I didn't take a good look at how nicely such a proposal would play with modifier trains though. Jan-Pieter Op di 10 jan. 2023 om 16:35 schreef 'Pascal Jasmin' via Programming < p

Re: [Jprogramming] (A n) new train. was: more fun with parallelism

2023-01-10 Thread &#x27;Pascal Jasmin&#x27; via Programming
usefully invoke (+/!.0) ? Thanks, -- Raul On Tue, Jan 10, 2023 at 1:12 PM 'Pascal Jasmin' via Programming wrote: > >  There is after all a Conjunction approach that permits ambivalent u verb, >and so for attributes that current native J code could leverage, it would be >possib

Re: [Jprogramming] (A n) new train. was: more fun with parallelism

2023-01-10 Thread &#x27;Pascal Jasmin&#x27; via Programming
2 : '[ u v'  NB. dyadic compose with repeated x, or monadic hook On Tuesday, January 10, 2023 at 10:35:16 a.m. EST, 'Pascal Jasmin' via Programming wrote: > S. I was going to suggest some foreign equivalent to S.  But this approach is sufficient.  A: (for (A)sso

Re: [Jprogramming] more fun with parallelism

2023-01-10 Thread &#x27;Pascal Jasmin&#x27; via Programming
> S. I was going to suggest some foreign equivalent to S.  But this approach is sufficient.  A: (for (A)ssociative declaration) would be another candidate.  if A: (or a foreign adverb) were used for this.  u S. could be a declaration/hint that the y argument to u is in sorted order. plus =: + A

Re: [Jprogramming] tine

2023-01-05 Thread &#x27;Pascal Jasmin&#x27; via Programming
missing line break, sorry  M =: @]  v2c =: 1 : '[. u ].' tine =: 1 : ' (M~) (u v2c) M ' On Thursday, January 5, 2023 at 07:32:34 p.m. EST, 'Pascal Jasmin' via Programming wrote:  M =: @]v2c =: 1 : '[. u ].' tine =: 1 : ' (M~) (u v2c)

Re: [Jprogramming] tine

2023-01-05 Thread &#x27;Pascal Jasmin&#x27; via Programming
 M =: @]v2c =: 1 : '[. u ].' tine =: 1 : ' (M~) (u v2c) M ' there was a recent change to allow gerund argument to &. & and &: could allow gerund v such that w&(u`v)  is (u@[ w v@]).  But tine as written is easier to use (only one function.  no parenthesizing gerund arguments). On Thursda

Re: [Jprogramming] Beginner: Where to start?

2022-12-28 Thread &#x27;Pascal Jasmin&#x27; via Programming
> J is an "array programming language," which is what exactly? J is a functional programming language where every function is an operator with 1 or 2 arguments. An array language is one where arrays are easy to input, and functions "automatically" extend to full arrays with implied map/zip func

Re: [Jprogramming] bug in `:6 WAS: Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
s might or might not be in the next beta. Henry Rich On 12/8/2022 8:13 PM, 'Pascal Jasmin' via Programming wrote: > A definition of F02 that eliminates all of my other boiler plate or potential > sources of error is > >   F02 =: 2 : '(u`)(`v)(`:6)'  NB. still

Re: [Jprogramming] bug in `:6 WAS: Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
ld do this myself if your code were less baroque. Henry Rich On 12/8/2022 7:24 PM, 'Pascal Jasmin' via Programming wrote: > Not 100% sure it is bug in `:6 or the interaction with F.. > > ex > > mjqjpqmgbljsphdztnvjfqwrcgsmlb > >   ((1>:@{::]),&<~[,~ _3{.0{::])`

Re: [Jprogramming] bug in `:6 WAS: Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
@v y') -:@[ F02 (+:@]) -:@[ +: (2 : (':'; 'x u@v y')) - +:@] :  2 - (+: 2 : 'x u@v y') -:@[ F02 (+:@]) 3 _10  NB. 1 and 6 are result of v0 and v2.  1 +:@- 6 = _10 One possible fix that would make everything cleaner is if (] F..) did not expand to explicit def

Re: [Jprogramming] Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
ed y structure.  On Thursday, December 8, 2022 at 06:01:45 p.m. EST, 'Pascal Jasmin' via Programming wrote: Part of the complexity is searching for index rather than "data".  There are several convenience functions that can simplify the code G0 =: 0 {:: ] G1 =: 1 {:: ] Z2

Re: [Jprogramming] Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
:35 p.m. EST, 'Michael Day' via Programming wrote: Thanks for your replies - I'll try to get round to understanding them. It's a pity the Fold approach to this problem appears to need to be verbose. Cheers, Mike On 08/12/2022 19:34, 'Pascal Jasmin' via Programming wr

Re: [Jprogramming] Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
st value or all of them. Henry Rich On 12/8/2022 3:02 PM, 'Pascal Jasmin' via Programming wrote: > so F. is like ^:_ , but instead of ^:(while true test)^:_ , use Z: to escape > it?  There is no fixed point escape? > > > > > > > On Thursday, Decembe

Re: [Jprogramming] Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
so F. is like ^:_ , but instead of ^:(while true test)^:_ , use Z: to escape it?  There is no fixed point escape? On Thursday, December 8, 2022 at 02:46:01 p.m. EST, Henry Rich wrote: no. Henry Rich On 12/8/2022 2:38 PM, 'Pascal Jasmin' via Programming wrote: > are th

Re: [Jprogramming] Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
are they forward or reverse? On Thursday, December 8, 2022 at 02:25:18 p.m. EST, Henry Rich wrote: Pascal wrote: > also it is not documented whether F. or F: are forward or reverse. As indicated in https://code.jsoftware.com/wiki/Vocabulary/fcap#Limited_vs_unlimited , they are not

Re: [Jprogramming] Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
|domain error On Thursday, December 8, 2022 at 02:15:39 p.m. EST, 'Pascal Jasmin' via Programming wrote: The short circuit you are trying to avoid is to skip the full partitioning part 4 #@~.\4  one approach is to separate into the simplest possible partition, then hope that i

Re: [Jprogramming] Is there a Fold for AOC day 6? - was Re: Questions on Advent of code Day 5

2022-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
The short circuit you are trying to avoid is to skip the full partitioning part 4 #@~.\4  one approach is to separate into the simplest possible partition, then hope that i. special code finds the short circuit. 4 + (1 i.~ 4 = #@~."1) 4 ]\ ex your power approach is completely reasonable. A fo

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-07 Thread &#x27;Pascal Jasmin&#x27; via Programming
┐ NB. │C│M│PDNZ│ NB. └─┴─┴┘ lfoldR=: {{ ]F..(u~) }} state move lfoldR moves NB. ┌─┬─┬┐ NB. │C│M│PDNZ│ NB. └─┴─┴┘ *Many thanks to you and to Raul and Henry*, On Tue, Dec 6, 2022 at 7:56 PM 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > To cl

Re: [Jprogramming] Questions on Advent of code Day 5

2022-12-06 Thread &#x27;Pascal Jasmin&#x27; via Programming
To clarify, A conjunction F.. in this case, is documented according to the same explicit defintion:  either 2 : 'u F.. v' or {{u F.. v}} In the above explicit definitions u is left argument to F..  v is right argument. lfold is an adverb. Has just one left argument u.  That adverb will place i

Re: [Jprogramming] Catenating columns.

2022-12-06 Thread &#x27;Pascal Jasmin&#x27; via Programming
The key is rank, and dyadic rank " u"(l, r) is u(" l r), where l and r specify the cell size of x and y for how u will be applied. ,"_ 0 is u = ,  l = _ r = 0 54 48,"1 0 i.10  NB. produces same result. u"0 means apply u to atoms u"1 to rows at a time u"2 to tables at a time u"_ to whole argum

Re: [Jprogramming] EVM

2022-12-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
The display for that page tries to "make columnar" results of raw expression and EVM expression.  The lines are not legal J. '*: 4' EVM  NB. should work *: 4 '*: 4' EVM  NB. results in N N - syntax error. On Saturday, December 3, 2022 at 07:14:41 a.m. EST, Richard Donovan wrote: I

Re: [Jprogramming] Questions about Advent of Code Day 2

2022-12-02 Thread &#x27;Pascal Jasmin&#x27; via Programming
your select function ev can be replaced with ev =: (9 3$'A XA YA ZB XB YB ZC XC YC Z')&(4 8 3 1 5 9 7 2 6 { ~ i.) ev 'A X' 4 On Friday, December 2, 2022 at 12:40:53 p.m. EST, Jaume wrote: Hello again I managed to solve it, but I don't like it much, so feel free to educate me. Readi

Re: [Jprogramming] Nub with extra column

2022-11-24 Thread &#x27;Pascal Jasmin&#x27; via Programming
can duplicate on windows, both of these are fast: ~. 1 ,.~ ?. 100 2$100 ~. 1 ,.~ ?. 100 4$100 On Thursday, November 24, 2022 at 12:40:33 a.m. EST, Elijah Stone wrote: That looks rather serious.  It seems some problem with the hashing function is causing an unreasonably high

Re: [Jprogramming] Feedback on the proposed design of the J wiki

2022-11-23 Thread &#x27;Pascal Jasmin&#x27; via Programming
I like it.  The video did point out useful features I would not have found on my own.  But, also don't need to be at forefront. The landing page did give me a first impression of a  very childlike retro vibe with the colours.  I quickly got used to it. On Wednesday, November 23, 2022 at 05:

Re: [Jprogramming] Truncating primes

2022-11-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
props for using { catalogue and managing a &. application in your step function. a design principle I was aiming for is a big strength of J.  What I call a "perfect function" defined as iterative form where output is of consistent shape/meaning as input, and where ^: can be used "separately" to

Re: [Jprogramming] Truncating primes

2022-11-20 Thread &#x27;Pascal Jasmin&#x27; via Programming
based on Raul's rosettacode link, but building an expaning list of left truncable primes, such that further search is possible on future "iterations"  selPrime=: #~ 1&p: ltrunc =: (] , ((1+i.9) (10 #. ,)"0 1 (10&#.inv))"0(,@:)(selPrime@:) each@:{:) # &> sofar =: ltrunc^:6 < 3 7x 2 11 39 99 19

Re: [Jprogramming] J blind spot

2022-10-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
:55:41 p.m. EDT, 'Pascal Jasmin' via Programming wrote: }.^:(0 = f@{.)^:_ will return the list with the head being the first f not equal 0. On Friday, October 21, 2022 at 12:19:41 p.m. EDT, Ed Gottsman wrote: Hi.  I’m blanking on something basic and research isn’

Re: [Jprogramming] J blind spot

2022-10-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
}.^:(0 = f@{.)^:_ will return the list with the head being the first f not equal 0. On Friday, October 21, 2022 at 12:19:41 p.m. EDT, Ed Gottsman wrote: Hi.  I’m blanking on something basic and research isn’t helping.  When the blindingly obvious solution is revealed I will blame a

Re: [Jprogramming] detect number but survive also string input

2022-09-10 Thread &#x27;Pascal Jasmin&#x27; via Programming
maybeton =: 0&".^:('0'&-: +. 0 -.@-: 0&".) 0&".^:('0'&-: +. 0 -.@-: 0&".)  maybeton '3 22r4' 3 11r2 maybeton '3e2 22r4 two'  NB. asking too much 300 5.5 0 maybeton 'two2' two2 On Saturday, September 10, 2022 at 02:49:30 p.m. EDT, Pawel Jakubas wrote: Dear J users, What is the way

Re: [Jprogramming] Poll questions: new refcard

2022-08-04 Thread &#x27;Pascal Jasmin&#x27; via Programming
By far prefer 1st footnote format.  Grouping together lets you read the footnote and find the reference in the main related section quickly. Colour coding of adv/conj is good.  Wish it was in jqt. Things seem to generally fit well on page.  If more information/columns in some sections would sti

Re: [Jprogramming] strange request

2022-07-25 Thread &#x27;Pascal Jasmin&#x27; via Programming
,"2^:(2 < #@$) i.3 3 3 2  NB. where ]`(,"2)@.  would fit your first request. > Also interested in usage of / or folds where the accumulator rank changes over time (especially if it continues to change after the 1st iteration). would not be drawn to this model, but when processing a a list of ite

Re: [Jprogramming] Question about the internal working of J

2022-07-24 Thread &#x27;Pascal Jasmin&#x27; via Programming
i'll note,  lr=: 3 : '5!:5 <''y''' lr i.100 i.100 dyadic $ also "does nothing" until some future time. On Sunday, July 24, 2022 at 11:17:12 a.m. EDT, Henry Rich wrote: For the record, i. 100 does not allocate space for 100 numbers.  It creates a virtual noun whose data is an infi

Re: [Jprogramming] local scope or more structured x and y?

2022-07-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
I would create a main verb that takes just y as a list of 9 numbers, where 0 is an encoding for "unsolved cell" and return a list of 9 numbers that provides a template to update a sequence of 9 numbers it was taken from where 0s are updated with solved numbers or where a cell can contain a list

Re: [Jprogramming] Problem with adverbs

2022-07-19 Thread &#x27;Pascal Jasmin&#x27; via Programming
ore flexible. 2 3 +(/ F1) 1 2 3 3 4 5 4 5 6 On Tuesday, July 19, 2022 at 02:39:19 p.m. EDT, Henry Rich wrote: [:y has the important function of signaling domain error. Henry Rich On 7/19/2022 2:35 PM, 'Pascal Jasmin' via Programming wrote: > I'll add that the f

Re: [Jprogramming] Problem with adverbs

2022-07-19 Thread &#x27;Pascal Jasmin&#x27; via Programming
the form (where ti is ` but turns nouns into gerunds) of {{([: ti >: ti u)(`:6)}} On Tuesday, July 19, 2022 at 12:26:47 p.m. EDT, 'Pascal Jasmin' via Programming wrote: some options, if you want your adverb to always produce a verb:  1 (>:@) >:@1 1 (>:@) 4

Re: [Jprogramming] Problem with adverbs

2022-07-19 Thread &#x27;Pascal Jasmin&#x27; via Programming
some options, if you want your adverb to always produce a verb:  1 (>:@) >:@1 1 (>:@) 4 2  NB. increment  on constant of 1 (u/m parameter)   +: (>:@) 4 9  NB. increment after applying u (double) to y if you want "polymorphism" in your adverb to return noun result or verb depending on u or

Re: [Jprogramming] Tacit definitions of adverbs and conjunctions ?

2022-07-02 Thread &#x27;Pascal Jasmin&#x27; via Programming
modifiers ((A)dverbs and (C)onjunctions) can return any form of speech (N V A C)  Though only have N or V arguments. in terms of tacit definitions for modifiers, thendouble =: +:@:  NB. adverb For modifier there is one form of explicit definition that can be distinguished as semi-tacit:  If y

Re: [Jprogramming] Tiling a matrix to produce a larger matrix

2022-07-01 Thread &#x27;Pascal Jasmin&#x27; via Programming
there is ,./ 2 8 $ i. 4 4 On Friday, July 1, 2022, 09:33:48 p.m. EDT, Thomas McGuire wrote: I was playing with the Window driver and trying to paint the toucan.bmp to the window I created. Expanding on that I wanted to pain a panel of toucan.bmp bitmaps to the background. Now I was

Re: [Jprogramming] Problem with @ (Atop)

2022-06-27 Thread &#x27;Pascal Jasmin&#x27; via Programming
Another way to state the equivalence of @, in linear form rather than tacitly u"v [x] v y On Monday, June 27, 2022, 03:30:35 p.m. EDT, 'Pascal Jasmin' via Programming wrote: You have brought up a bug in dicitionary, that has survived to J6.02 @: has the correct a

Re: [Jprogramming] Problem with @ (Atop)

2022-06-27 Thread &#x27;Pascal Jasmin&#x27; via Programming
You have brought up a bug in dicitionary, that has survived to J6.02 @: has the correct analogous quoted linear definition. the actual equivalence is 1 2 3 ([: +/ *)"* 4 5 6 4 10 18 or, ([: u v)"v On Monday, June 27, 2022, 08:21:47 a.m. EDT, Jacques Bailhache wrote: According to h

Re: [Jprogramming] Fork does not work

2022-06-22 Thread &#x27;Pascal Jasmin&#x27; via Programming
appliedto is an adverb. (happens to always return true, and select only right hand of gerund argument) mult is a monad that returns a gerund  Your last example is V A V which gets parsed as (V A) V But appliedto needs a gerund argument to not be a domain error. (mult appliedto) is an error. 

Re: [Jprogramming] CVA (was: unwind protect)

2022-05-01 Thread &#x27;Pascal Jasmin&#x27; via Programming
onsistent with CCA and CVC. It's true there are multiple ways to express the same thing; there always are. Making AC consistent with CA is interesting, but since 2-trains are inherently asymmetric anyway (except CC), it seems less important.  And changing AC breaks compatibility, whereas add

Re: [Jprogramming] unwind protect

2022-05-01 Thread &#x27;Pascal Jasmin&#x27; via Programming
A J approach where, v is a monadic resource acquisition function (file open, acquire lock) with a defined inverse whose result we normally don't care about (want the result of u).  v inv should raise an error instead of return an error code.  there are 2 options for y argument to v inv :  v in

Re: [Jprogramming] CVA (was: unwind protect)

2022-05-01 Thread &#x27;Pascal Jasmin&#x27; via Programming
There is a more "obvious" interpretation of CVA (CV)A is the more natural extension of uCV A.  (C(VA)) would be a possibility that is less obvious. Your proposal can be accomplished with CV(].A)  NB. also allows CV([.A) for flexibility of A binding. The current interpretation of AC could be ac

Re: [Jprogramming] unwind protect

2022-05-01 Thread &#x27;Pascal Jasmin&#x27; via Programming
~~ can be used with even a tacit function.  Makes u dyad only. I want to avoid using AC hoping it gets changed, but: 1 : ' u@]~~ : u '  or simpler 1 : ' u@] : u ' The ~~ form lets dyadic u access original y as x, and any processed y as y. On Sunday, May 1, 2022, 04:07:19 a.m. EDT, Elijah S

Re: [Jprogramming] general fold

2022-04-23 Thread &#x27;Pascal Jasmin&#x27; via Programming
fold may not be the right approach 1 ( 3 2 $ 1 2 3 4 5 6)} 10 10 $ 0 On Saturday, April 23, 2022, 02:02:10 p.m. EDT, Pawel Jakubas wrote: Dear J enthusiast, I try to play with fold functionality F... and here solve more general cases, so when the accumulator structure is different f

Re: [Jprogramming] lex / dev question

2022-04-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
> (].~)@: It is the CC train.  The @: will bind to u@:v (].~) is CA  (so still part of overall CC train (CA)C is CC) ]. ignores u, and so (].~) is v~ On Thursday, April 21, 2022, 10:35:41 a.m. EDT, Michal Wallace wrote: Thanks, Elijah! This was very helpful. I think I was sort of

Re: [Jprogramming] lex / dev question

2022-04-20 Thread &#x27;Pascal Jasmin&#x27; via Programming
the removing y part -semi tacit 2 :  'u@:v v ]' I don't think there is a "modifier train" expression that would be full tacit. On Thursday, April 21, 2022, 01:42:48 a.m. EDT, Michal Wallace wrote: I want to write this tacitly:     AA =: {{ (u v y) v y }} For context, I tend to use

Re: [Jprogramming] Help required

2022-04-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
This approach is efficient because it is checking the "2 halves" of the 6char list on existence in the 3 char list, instead of permuting all combinations of 3-list items. On Friday, April 8, 2022, 10:32:51 a.m. EDT, Henry Rich wrote:    l =. 'abc','def',:'ghi'    l abc def ghi    r

Re: [Jprogramming] Verb concatenation

2022-04-02 Thread &#x27;Pascal Jasmin&#x27; via Programming
want to draw attention to a bug in the jplayground using a variation of your script https://jsoftware.github.io/j-playground/bin/html/emj.html#code=%20foo0%3D%3A%203%20%3A%20'0'%0D%0A%20%20foo1%3D%3A%203%20%3A%20'1'%0D%0A%20%20foo2%3D%3A%203%20%3A%20'2'%0D%0A%20%20foo3%3D%3A%203%20%3A%20'3'%0D%0A

Re: [Jprogramming] RFC: unicode

2022-03-19 Thread &#x27;Pascal Jasmin&#x27; via Programming
The proposed semantics (It probably would help everyone if there was a shorter retelling of the semantics, even assuming the reader was able to skim through most of it.) there is a UCS-1 that is different from J's utf8?  Is UCS-1 actually an update of utf8 that has differences? Does your propo

Re: [Jprogramming] RFC: unicode

2022-03-18 Thread &#x27;Pascal Jasmin&#x27; via Programming
3 u: 8 u: 97 243 98 97 195 179 98 3 u: 10 u: 97 243 98 97 243 98 the key takeaway is that utf8 is flakey if you ever want your numbers back.  Converting utf8 (literal) to unicode or unicode4 prior to counting/appending them with other unicode should stay sane(?) 3 u: 7 u: 8 u: 97 243 98 97

Re: [Jprogramming] Report on the J wiki meeting of January 27, 2022

2022-03-14 Thread &#x27;Pascal Jasmin&#x27; via Programming
I'll remind "the world" that a dictionary implementation has been published:  https://github.com/Pascal-J/kv I'll defend it as being the most J friendly implementation for having functional access + manipulation features, it further has, through the kvO adverb, the ability to J-optimize access a

Re: [Jprogramming] Sort

2022-03-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
Yes.  Sort sorts items which are rows in this case. if you didn't transpose, the rows would already be sorted. On Sunday, March 13, 2022, 08:51:22 p.m. EDT, 'Skip Cave' via Programming wrote: Is this how sort is supposed to work? sep=:10#.^:_1] |:sep 120 to 130 1 1 1 1 1 1 1 1 1 1

Re: [Jprogramming] prime testing on large numbers

2022-03-09 Thread &#x27;Pascal Jasmin&#x27; via Programming
I've provided OPENSSL bindings including miller-rabin on large numbers. https://github.com/Pascal-J/BN-openssl-bindings-for-J openssl is/was included in windows J distributions. And available as near default on linux/mac afaik. The case for libgmp may be better for "overall math" but since both

Re: [Jprogramming] Amend an array with an array

2022-03-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
3 5 7 9 (0 0;0 1;1 0;1 1)} i.5 5 On Wednesday, March 9, 2022, 12:47:32 a.m. EST, Richard Donovan wrote: Can I amend an array with a smaller array? For example amend a 5x5 array by a 2x2 array starting at location x,y within the larger array? Thanks Richard Donovan -

Re: [Jprogramming] Power Conjunction

2022-03-05 Thread &#x27;Pascal Jasmin&#x27; via Programming
(+/ , 2 + {:)^:(i.8) 5 4 where your series is in first column. On Saturday, March 5, 2022, 08:55:37 p.m. EST, 'Skip Cave' via Programming wrote: I have this series: 5 9 15 23 33 5+4 9 9+6 15 15+8 23 23+10 33 How can I use the power conjunction to generate this series?

Re: [Jprogramming] Higher-order arrays?

2022-03-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
u, Mar 3, 2022 at 3:28 PM 'Pascal Jasmin' via Programming wrote: > I understand your metashape and data concept to be (using my prior > example): > > (3 2 2 ,: 4 1 1) $ i.16 > > would let code know that there are 12 items in 1st array, and 4 in 2nd. That example matches h

Re: [Jprogramming] Higher-order arrays?

2022-03-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
ould contain 35 integers. How many integers would the meta array contain in your model? Thanks, -- Raul On Thu, Mar 3, 2022 at 3:06 PM 'Pascal Jasmin' via Programming wrote: > > when "subarrays" are all the same rank and there are x such items then shape > is x

Re: [Jprogramming] Higher-order arrays?

2022-03-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
not have made the above typo if the input form for ragged shapes were boxes.  > So > > (3 2 2;4) as a shape does not need to care about padding, and then some other > future meaning for table shapes could be looked into. > > > > > > > On Thursday, March 3, 2022, 11:5

Re: [Jprogramming] Higher-order arrays?

2022-03-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
an "array" whose "shape's rank" is higher than 1 should represent a collection of arrays of the same rank. -- Raul On Thu, Mar 3, 2022 at 11:50 AM 'Pascal Jasmin' via Programming wrote: > > I'm ok with the 0s, but another way to have 2 shapes (referring

  1   2   3   4   5   6   7   8   9   10   >