Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-08 Thread 'Pascal Jasmin' via Programming
in terms of copying one node to another, ((1 ; 0)&{:: <@[ each amendT 0 ]) 0 ;<(< i.5);i.4 ┌───┬─┐ │┌─┐│┌───┬───┐│ ││0 1 2 3 4│││┌─┐│0 1 2 3││ │└─┘│││0 1 2 3 4││ ││ │ ││└─┘│ ││ │ │└

Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
I think that is awesome, Thomas. For those who didn't load the code, its much easier to use than it looks as everything is a verb, and the whole thing is like a mini stack language, and each operation produces intuitive and visible results. - Original Message - From: Thomas Costigli

Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-09 Thread &#x27;Pascal Jasmin&#x27; via Programming
L. might be a candidate. (depth) # of leaves (boxes) might be the most popular ([: +/ 1: S:0) When a tree holds nested records (say customers invoices products bought), then the # of records could be defined as just # . You might want to know number of invoices, but can't naively use L: becaus

Re: [Jprogramming] Replace one item of a list

2014-09-09 Thread &#x27;Pascal Jasmin&#x27; via Programming
We understand the parsing rules as: a =: a to cause =: to have no awareness that 'a' was a part of the far off expression to the right. - Original Message - From: Roger Hui To: Programming forum Cc: Sent: Tuesday, September 9, 2014 12:35 PM Subject: Re: [Jprogramming] Replace

Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-09 Thread &#x27;Pascal Jasmin&#x27; via Programming
programming] Ragged Array Shapes are Trees From: "'Pascal Jasmin' via Programming" Date: Tue, 9 Sep 2014 07:16:46 -0700 To: "programm...@jsoftware.com" L. might be a candidate. (depth) # of leaves (boxes) might be the most popular ([: +/ 1: S:0) When a

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
as nice as # inv is, you may find this adverb more flexible and intuitive: insertitem =: 1 : '(u"_ {. ]) , [ , u"_ }. ]' the adverb argument is a verb that tells which item position to insert. The verb argument is dyadic, but can be a constant verb. Add @:] to it to just use y as the argument

Re: [Jprogramming] Question on rank conjunction's behavior regarding "unexpected" vector transposition

2014-09-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
to get a column sum, all of these would work +/ +/"_1 i.2 4 7 196 204 212 220 228 236 244 +/ +/"2 i.2 4 7 196 204 212 220 228 236 244 +/ +/ i.2 4 7 / or +/ in this case will only "remove" (reduce along) one dimension at a time. - Original Message - From: George Dallas To: pro

Re: [Jprogramming] wait, what?

2014-09-12 Thread &#x27;Pascal Jasmin&#x27; via Programming
works in J7 too (152{a.)~ 0 1 2 3 4 5 6 7 8 - Original Message - From: Raul Miller To: Programming forum Cc: Sent: Friday, September 12, 2014 10:09 PM Subject: Re: [Jprogramming] wait, what? I was using jqt 802 on desktop. FYI, -- Raul On Fri, Sep 12, 2014 at 9:09 PM, bill la

Re: [Jprogramming] OOJ and calling a verb from another locale

2014-09-15 Thread &#x27;Pascal Jasmin&#x27; via Programming
locs_z_ =: 1 : 'm loc 18!:5 ' loc_z_=: (,&'_'@[ ,&'_'@, ":@>@])"1 0 'Do' loc 'z' Do_z_ 'Do' locs Do_base_ mean_asd_ =: +/%# data_asd_ =: 1 2 3 ". ('mean' loc <'asd') , ' ' , ": data_asd_ 2 inl_z_ =: (cocurrent@] ".@] [)"1 0 'mean data' inl <'asd' 2 If you are run

[Jprogramming] wd commands to destroy a control

2014-09-16 Thread &#x27;Pascal Jasmin&#x27; via Programming
in Jqt, is there a way to either destroy a control by id, or clear the whole form and add all controls again? (I guess the latter can be done by destroying the form and recreating it) maybe one of the grids can host and delete controls? Some example uses would be: Options that turn off some f

Re: [Jprogramming] wd commands to destroy a control

2014-09-16 Thread &#x27;Pascal Jasmin&#x27; via Programming
mand which "clear" a top level window (a form), some (or all?) children the parent window contained were destroyed when choosing a different board size. On Sep 17, 2014 12:28 AM, "'Pascal Jasmin' via Programming" < programm...@jsoftware.com> wrote: > in Jqt,

Re: [Jprogramming] OOJ and calling a verb from another locale

2014-09-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
A class approach to problem solving is a very useful organization structure for dealing with the normal case that you are unsure how to solve the problem (or the problem is likely to be redefined perhaps by yourself as you go). You can almost always replace a class with a record/struct structure

Re: [Jprogramming] OOJ and calling a verb from another locale

2014-09-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
You may find this article helpful: http://www.jsoftware.com/jwiki/PascalJasmin/3%20types%20of%20adverbs%20conjunctions%20and%20binding These are indeed issues you understand by surprise (why is this code not doing what I meant it to do) comming from other languages. - Original Message ---

Re: [Jprogramming] OOJ and calling a verb from another locale

2014-09-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
on. The concept of tacit is slippery enough that it's probably worth quoting the definition you are using, and describing what it is about the context that makes "tacit" a relevant concept whenever we talk about it. Anyways, I got stuck there, and I thought you should know. Thanks,

Re: [Jprogramming] OOJ and calling a verb from another locale

2014-09-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
I've pulled out the term semi-tacit before. tacit -- no : semi-tacit -- no x or y or : inside the quoted code. explicit -- y referenced. - Original Message - From: Dan Bron To: programm...@jsoftware.com Cc: Sent: Wednesday, September 17, 2014 2:23 PM Subject: Re: [Jprogramming] OOJ and

Re: [Jprogramming] OOJ and calling a verb from another locale

2014-09-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
uot;the first 2 types of adverbs (or > conjunctions)" or are you referring to nounconj and nounconj2? If the > latter, I think the statement is erroneous. If the former, I'm a bit > dubious about the distinction. > > The concept of tacit is slippery enough that it's pr

Re: [Jprogramming] LZ77

2014-09-18 Thread &#x27;Pascal Jasmin&#x27; via Programming
patents issued before sept 1996 have already expired. If they were filed in 1994 (but issued up to 1997) they are expired. The condition where the issue date took abnormally long but were filed prior to june 1995 grants 17 years from the issue date. From, http://www.faqs.org/faqs/compression

Re: [Jprogramming] zlib addon thanks

2014-09-23 Thread &#x27;Pascal Jasmin&#x27; via Programming
load 'arc/zlib' install_zlib_ '' NB. downloads lib (just needs to be done once) load 'arc/zlib' NB. reload after first dl. - Original Message - From: Devon McCormick To: J-programming forum Cc: Sent: Tuesday, September 23, 2014 1:33 PM Subject: Re: [Jprogramming] zlib addon thanks H

Re: [Jprogramming] zlib addon thanks

2014-09-23 Thread &#x27;Pascal Jasmin&#x27; via Programming
Windows 7 - should it be available for this OS? Thanks... On Tue, Sep 23, 2014 at 1:41 PM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > load 'arc/zlib' > install_zlib_ '' NB. downloads lib (just needs to be done once) > load

[Jprogramming] suggested language enhancements using . and : with a name

2014-09-23 Thread &#x27;Pascal Jasmin&#x27; via Programming
You may already be aware that J's tokenizer keeps . and :'s ending a token as part of that token ;: 'name. 3 4 name::fd' ┌─┬───┬──┬──┐ │name.│3 4│name::│fd│ └─┴───┴──┴──┘ we could take advantage of this tokenizing by invoking special parsing rules based on the presence of

[Jprogramming] wd 'setlocale'

2014-09-24 Thread &#x27;Pascal Jasmin&#x27; via Programming
is there a way to change syslocalep for a form? change it to a numbered locale? in j803? I am referring to syslocalep. it would simplify having an object create its own form, and handling multiple instances. -- For information

Re: [Jprogramming] wd 'setlocale'

2014-09-25 Thread &#x27;Pascal Jasmin&#x27; via Programming
thank you Bill. That is a good design. - Original Message - From: bill lam To: 'Pascal Jasmin' via Programming Cc: Sent: Thursday, September 25, 2014 1:00 AM Subject: Re: [Jprogramming] wd 'setlocale' form locale can be numbered locale since day 1. Specificall

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread &#x27;Pascal Jasmin&#x27; via Programming
this works (, >:@?@6:)^:((0=#) +. 6={:)^:_ i.0 ([: +/ (, >:@?@6:)^:((0=#) +. 6={:)^:_) i.0 11 - Original Message - From: Johann Hibschman To: Programming forum Cc: Sent: Thursday, September 25, 2014 9:06 AM Subject: [Jprogramming] Repeated rolling dice Hi all, For fun, I've b

Re: [Jprogramming] Repeated rolling dice

2014-09-25 Thread &#x27;Pascal Jasmin&#x27; via Programming
there's a small issue with it, (if last roll is a 6) (}:1,6~:x) <;.1 x=. 6 1 6 6 2 3 6 ┌───┬─┬─┬─┐ │6 1│6 6 2│3│6│ └───┴─┴─┴─┘ if you've never seen a use for i.15 0 before, ([: +/ (, >:@?@6:)^:((0=#) +. 6={:)^:_)"1 i.15 0 3 13 3 3 11 1 2 3 5 4 9 4 1 3 1 or (, >:@?@6:)^

Re: [Jprogramming] dyad i. on sparse array

2014-09-26 Thread &#x27;Pascal Jasmin&#x27; via Programming
I'd hope they were the same too, but here is what is happening: 1 i.~"1 $. #: i.5 1 │ 2 2 │ 1 3 │ 1 4 │ 0 Your result happens due to fill. There could be a !. solution if !. allowed fills to be set for any function (not defined for = or other purpose) or was defined for $. inv - Or

Re: [Jprogramming] Repeated rolling dice

2014-09-26 Thread &#x27;Pascal Jasmin&#x27; via Programming
r=. mask +/;.1 r > end. > y{.r > ) > > But statistically speaking, this is still not as efficient as it could be. > I think we'd do better with: > > bulkd6=:3 :0 > r=. i. 0 > while. y >: #r do. > r=. r, d6s 2*y > mask=. }: 1, 0~:6|r >

Re: [Jprogramming] dyadic adverb for ambivalent verb

2014-10-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
took me a while to find it, as it is a mistake I often make: nn =: ('a' ('t' adv) ]) : ([ 't' adv ]) - Original Message - From: Brian Schott To: Programming forum Cc: Sent: Friday, October 3, 2014 1:56 PM Subject: [Jprogramming] dyadic adverb for ambivalent verb I have defined an ad

Re: [Jprogramming] How can I I box items in an array

2014-10-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
don't think that is possible, perhaps this helps ,. ;: 'H IJ' ┌──┐ │H │ ├──┤ │IJ│ └──┘ - Original Message - From: Linda Alvord To: programm...@jsoftware.com Cc: Sent: Friday, October 3, 2014 10:00 PM Subject: [Jprogramming] How can I I box items in an array What I would li

Re: [Jprogramming] Project Euler 85, Python and J

2014-10-07 Thread &#x27;Pascal Jasmin&#x27; via Programming
countRects a cool solution that just works without my complete understanding of it either. I'm not convinced of the getSizes range being used though: this is pretty close to 2M 4 %~ */@(, >:) 3 816x 216 So I think a "triangulation" algorithm would be more general than the getSizes fil

Re: [Jprogramming] what is happening here?

2014-10-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
you have reference x and y without u or m. There is a global setting (6! or 9! something) to turn this off I think. I don't see why you are using an adverb here. on another note: bind 2 : 'x@(y"_)' is there any case where the definition 2 : 'u@(v"_)' would fail or produce a different r

Re: [Jprogramming] what is happening here?

2014-10-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
uot;braindead" mode for when I am recovering from > being ill (like today) or very tired. > > (This would issue domain errors at define time if x and y are being > promoted to u/v significance.) > > I'm not sure how hard that would be to implement, however. > > Tha

Re: [Jprogramming] Splitting vector

2014-10-09 Thread &#x27;Pascal Jasmin&#x27; via Programming
there is: 0 1 0 1 (# ,:~ -.@:[ # ]) i.4 0 2 1 3 or as an adverb that uses a function (of the data) to split the data 2&| 1 : '(-.@:u # [) ,: u # ]' i.8 0 2 4 6 1 3 5 7 - Original Message - From: Andrey Paramonov To: "programm...@jsoftware.com" Cc: Sent: Thursday, October

[Jprogramming] an inverse to I.

2014-10-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
I notice that there is no inverse to I. that is defined. Is this an appropriate one? ([: +./ ( 1 ,~ I.)"0) 7 9 0 0 0 0 0 0 0 1 0 1 I. ([: +./ ( 1 ,~ I.)"0) 0 7 9 0 7 9 -- For information about J forums see http://www.j

Re: [Jprogramming] an inverse to I.

2014-10-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
~ I.)"0 >:/~ i.3 1 0 0 1 1 0 1 1 1 I. >:/~ i.3 0 0 0 0 1 0 0 1 2 Ii(I. >:/~ i.3) 1 0 0 1 1 0 1 0 1 greg ~krsnadas.org -- from: 'Pascal Jasmin' via Programming to: Programming forum date: 11 October 2014 09:12 subject: [Jprogramming] an inverse to I. I notice

Re: [Jprogramming] an inverse to I.

2014-10-11 Thread &#x27;Pascal Jasmin&#x27; via Programming
m: greg heil To: Programming forum Cc: Sent: Saturday, October 11, 2014 2:24 PM Subject: Re: [Jprogramming] an inverse to I. Pascal Indeed taking them one at a time seems to work ... though REB's objection still stands: Ii &> I. each <"1 [2 16$0 0 0 0 0 0 0 1 0 1 0 0

Re: [Jprogramming] An easy one

2014-10-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
there is also: 2 (^~ * ^)/\ p: i.6x 72 30375 1313046875 38532504363714053 61870237399093306018139447 which has a winking cat power :P From: Roger Hui To: Programming forum Sent: Friday, October 17, 2014 7:49 PM Subject: Re: [Jprogramming] An easy one

Re: [Jprogramming] Insert a 2 dimensional array to a n dimensional array

2014-10-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
there is this fairly intuitive approach to2 =: ( [: <"1 [: ,."0/&>/ [: i.@:>: each -~) to =: 2 : 'm ,@:to2 n' 0 0 to 2 2 ┌───┬───┬───┬───┬───┬───┬───┬───┬───┐ │0 0│0 1│0 2│1 0│1 1│1 2│2 0│2 1│2 2│ └───┴───┴───┴───┴───┴───┴───┴───┴───┘ 1 (0 0 to 2 2) } i.4 4 1 1 1 3 1 1 1

Re: [Jprogramming] An easy Euler Project one (485)

2014-10-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
I don't completely understand number of divisors, but note: */@:(>:@{:)"2@(__&q:) 30 8 q: 30 2 3 5 I don't know why number of divisors of 39 would not be 3. Though I guess the divisors are 1 2 3 5 6 10 15 30 So, your d function looks like it should be efficient as long as __ & q: is

Re: [Jprogramming] An easy Euler Project one (485)

2014-10-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
An optimization of this problem may actually center around M and not d. If the range of M includes a number with only small prime factors, then that will be a candidate for max d within the range of M. if 2^k is within the range, then it is a candidate. 3 * 2^k-1 would have more total divisors 9

Re: [Jprogramming] An easy Euler Project one (485)

2014-10-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
n the order of several terabytes of memory for intermediate results if we were to store the entire sieve in the obvious way. So some extra work would be needed, and I'm not sure how that would pan out. -- Raul On Tue, Oct 21, 2014 at 5:27 PM, 'Pascal Jasmin' via Pr

Re: [Jprogramming] An easy Euler Project one (485)

2014-10-21 Thread &#x27;Pascal Jasmin&#x27; via Programming
rs of n : > > n=. 144 > > ~. n +. 1+i.n > 1 2 3 4 6 8 9 12 16 18 24 36 48 72 144 > __ q: 144 > 2 3 > 4 2 > */ 1 + 4 2 > 15 > # ~. n +. 1+i.n > 15 > > > > On Tue, Oct 21, 2014 at 12:46 PM, 'Pascal Jasmin' via Programming < &

Re: [Jprogramming] count of consecutive 1s

2014-10-22 Thread &#x27;Pascal Jasmin&#x27; via Programming
a couple of tacit versions of this (+/\ - [: >./\ -. * +/\) 0 1 1 1 0 1 1 1 0 1 1 0 0 1 0 0 0 0 1 1 (+/\ ([ - [: >./\ -.@:] * [) ]) 0 1 1 1 0 1 1 1 0 1 1 0 0 1 0 0 0 0 1 1 - Original Message - From: Roger Hui To: Programming forum Cc: Sent: Wednesday, October 22, 2014 1:25 PM Subject

Re: [Jprogramming] An easy Euler Project one (485)

2014-10-23 Thread &#x27;Pascal Jasmin&#x27; via Programming
we would need something on the order of several terabytes of memory for intermediate results if we were to store the entire sieve in the obvious way. So some extra work would be needed, and I'm not sure how that would pan out. -- Raul On Tue, Oct 21, 2014 at 5:27 PM, 'Pascal Jasmin'

Re: [Jprogramming] An easy Euler Project one (485)

2014-10-24 Thread &#x27;Pascal Jasmin&#x27; via Programming
either, providing only 990 elements, and sum 17168 . I can't quite get what you're doing here. (I can talk!) I see that 21* will hoover up all numbers with 3 & 7 as factors, but its list will include numbers also generated by 14* and 15* etc. FWIW,48390900720 is about 5% away fr

Re: [Jprogramming] An easy Euler Project one (485)

2014-10-25 Thread &#x27;Pascal Jasmin&#x27; via Programming
gt;> >> p =. 2 >> >> while. p < %:n do. >> >> pp =. 1 >> >> np =. (<.n%p)<.<.p^npl =. <.p^.n >> >> q =. np#0 >> >> pl =. p^i.npl+1 >> >> NB. get q = powers of prime p >> >> NB. eg q for p=3 is 1 1 2 1 1 2 1 1 3 .

Re: [Jprogramming] An easy Euler Project one (485)

2014-10-25 Thread &#x27;Pascal Jasmin&#x27; via Programming
S I played around with that "sliding window" article I cited earlier. Not surprisingly, it crawls like a snail with an effort to program it in J. Too loopy. Perhaps I could tacitise it, but not easy and hardly worth the effort. On 25/10/2014 17:51, 'Pascal Jasmin' vi

Re: [Jprogramming] datetime addin not working

2014-10-26 Thread &#x27;Pascal Jasmin&#x27; via Programming
The 3 key points about locales: 1. The default console locale is 'base'. You do not need to access names with the name_base_ modifier if in current locale. 2. In code (or console) if you issue the line cocurrent 'newlocale' then all subsequent definitions use that locale as the current (and so

[Jprogramming] 32 bit mersenne twister in 64 bit J

2014-10-28 Thread &#x27;Pascal Jasmin&#x27; via Programming
The algorithm for ? generation (mode 2 in NRG select) changed in J-64. Is there a way to import j.dll functions so as to use the old version? see http://www.jsoftware.com/pipermail/programming/2014-June/037583.html That request aside, I was able to create some portable (32 and 64 bit identica

Re: [Jprogramming] 32 bit mersenne twister in 64 bit J

2014-10-29 Thread &#x27;Pascal Jasmin&#x27; via Programming
ion On Tue, Oct 28, 2014 at 8:17 PM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > The algorithm for ? generation (mode 2 in NRG select) changed in J-64. Is > there a way to import j.dll functions so as to use the old version? > > see http://w

Re: [Jprogramming] 32 bit mersenne twister in 64 bit J

2014-10-29 Thread &#x27;Pascal Jasmin&#x27; via Programming
a 64-bit process. On Wed, Oct 29, 2014 at 10:46 AM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > I was hoping the 32 bit functions somehow exist, and there is an > abracadabra that unlocks them, in 64 bit J. > > > - Original Message - &

Re: [Jprogramming] 32 bit mersenne twister in 64 bit J

2014-10-30 Thread &#x27;Pascal Jasmin&#x27; via Programming
That would be helpful. It would work for mode 3 (DX-1597-4d), and it would make it possible to include MT19937-32 as mode 5 with unchanged source for that algorithm for whatever compilation target. From: bill lam To: 'Pascal Jasmin' via Programm

Re: [Jprogramming] 32 bit mersenne twister in 64 bit J

2014-10-31 Thread &#x27;Pascal Jasmin&#x27; via Programming
a way to specify the RNG to use, it might make sense to enhance this to include 32- and 64-bit versions rather than use fit. On Thu, Oct 30, 2014 at 12:14 PM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > That would be helpful. It would work for mode

Re: [Jprogramming] shorter way to prefix lines altenatively?

2014-11-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
nice, can kind of work for odd rows too: (1 1;1 2) ,(L:0) _2[\ <"1 i.4 4 ┌─┬───┐ │1 1 0 1 2 3 │1 1 4 5 6 7│ ├─┼───┤ │1 2 8 9 10 11│1 2 12 13 14 15│ └─┴───┘ or (1 1;1 2) ,(L:0) |: _2[\ <"1 i.4 4 ┌───

Re: [Jprogramming] Need analog strcmp-function verb

2014-11-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
/: doesn't really work for unicode, unless you convert unicode into an integer mapping and then use that as x for /: /: has the advantage of working with boxed data, or "records"/lists With those limitations we could think of using ,:&(a.&i.)&": to build numeric arrays to compare, but that runs

Re: [Jprogramming] Need analog strcmp-function verb

2014-11-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
0 3 1 2 That said, this kind of a distinction matters quite a lot to implementers and is likely to escape the awareness of people doing the specifications. Thanks, -- Raul On Thu, Nov 13, 2014 at 11:35 AM, 'Pascal Jasmin' via Programming wrote: > /: doesn't really work for un

Re: [Jprogramming] Setting arbitrary leaf of tree

2014-11-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
there is no }:: This conjunction seems to enable a solution for most similar problems. It is set to take verbs only, and you get to learn a lot about conjunctions and each by practising with it. :P amend_z_ =: 2 : 0 NB. v is n or n{"num s=. v"_ y (u (s{y)) (s}) y : s=. v"_ y (x u (s{y))

Re: [Jprogramming] Windows Clipboard

2014-11-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
wdclippaste wd@('clippaste'"_) ::(''"_) I don't know the other one, but wd 'clipcopy 1 2 3' puts '1 2 3' on clipboard. - Original Message - From: Leigh J. Halliwell To: programm...@jsoftware.com Cc: Sent: Thursday, November 13, 2014 4:31 PM Subject: [Jprogramming] Windows Clipboard

Re: [Jprogramming] projecting onto a fixed grid

2014-11-14 Thread &#x27;Pascal Jasmin&#x27; via Programming
here is a typical way to get the bin count (~. ,: #/.~) 5 10 20 # 100 200 300 100 200 300 5 10 20 you can obtain a "stretch factor" with e. 5 10 20 e.~ 5 * i.5 0 1 1 0 1 then apply the stretch factor with # inv 100 200 300 # inv~ 5 10 20 e.~ 5 * i.5 0 100 200 0 300 all together: (5

Re: [Jprogramming] Setting arbitrary leaf of tree

2014-11-14 Thread &#x27;Pascal Jasmin&#x27; via Programming
that is a cool function. Similar to Raul's for those who had problems copying it: applyintree =: 2 : 0 if. #n do. ((u applyintree (}.n)) L:_1 ({.n){y) ({.n)} y else. u y end. : NB. The rank is s,0 where s is the surplus of x-rank over y-rank. This causes NB. the cells of y to be matched up w

[Jprogramming] memory mapped files as non-volatile storage

2014-11-15 Thread &#x27;Pascal Jasmin&#x27; via Programming
Let's say I'd like to keep 5 data items as "permanent" accross program restarts. They change frequently. For example counters that are used as keys for next table records. Is keeping these counters in a memory mapped file, recommended? The nature of the counters is that they just need to nev

Re: [Jprogramming] Setting arbitrary leaf of tree

2014-11-16 Thread &#x27;Pascal Jasmin&#x27; via Programming
version of }:: (even if it is only done for having a sense of completeness; a http://www.jsoftware.com/forumsearch for }:: returns 44 hits so far). Henry's applyintree conjunction could be a model for it but we do not fully understand it; see also Thomas's comment in the message http://www.j

Re: [Jprogramming] memory mapped files as non-volatile storage

2014-11-16 Thread &#x27;Pascal Jasmin&#x27; via Programming
there is FlushFileBuffers on windows (which is also available on mono), though I understand the real linux equivalent is fsync. It applies to OSX and android too. It can be expensive to call often, and the crossplatform behaviour can be iffy as some filesystems let the hard drive decide wheth

[Jprogramming] a weird thing with multiple : conjunction

2014-11-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
as a test function Volume =: 3 : '''Volume is :'', (": l*w*h), '' for length '', (": l) , '' width '' , (": w) , '' and height '' , (": h) [''l w h'' =. y' Volume 3 4 5 Volume is :60 for length 3 width 4 and height 5 some functions for currying arbitrary parameters hook =: 2 : '([: u v) :

Re: [Jprogramming] a weird thing with multiple : conjunction

2014-11-17 Thread &#x27;Pascal Jasmin&#x27; via Programming
gument, that's not an obstacle: I can curry ] and use that curried verb to provide the right argument of my dyadic verb. And I think that that approach is fine and good, if I am really trying to define useful modules. Of course, another approach would be to define something like: Volume@(3,

Re: [Jprogramming] Boxing columns

2014-11-19 Thread &#x27;Pascal Jasmin&#x27; via Programming
Yes :P... a bit hard. allowed to use &. ? - Original Message - From: Henry Rich To: Programming forum Cc: Sent: Wednesday, November 19, 2014 5:08 PM Subject: Re: [Jprogramming] Boxing columns And I also meant, no use of @ . Henry Rich On 11/19/2014 5:05 PM, Henry Rich wrote: >

Re: [Jprogramming] What's wrong with assigment?

2014-11-19 Thread &#x27;Pascal Jasmin&#x27; via Programming
can use instead assign =: 4 : '(x) =: y' 'a' assign 2 you might like: assignwith 1 : 0 y assign u (y~ [ ]) :: ((i.0)"1) 1 : y assign x u (y~ [ ]) :: ((i.0)"1) 1 ) 5 +&^. assignwith 'a' 2.30259 a 2.30259 a =: @ ^. 5 |syntax error syntax error because adverb noun is not allow

Re: [Jprogramming] Boxing columns

2014-11-19 Thread &#x27;Pascal Jasmin&#x27; via Programming
ry Rich On 11/19/2014 5:21 PM, 'Pascal Jasmin' via Programming wrote: > Yes :P... a bit hard. allowed to use &. ? > > > - Original Message - > From: Henry Rich > To: Programming forum > Cc: > Sent: Wednesday, November 19, 2014 5:08 PM > Subject: Re:

Re: [Jprogramming] Boxing columns

2014-11-19 Thread &#x27;Pascal Jasmin&#x27; via Programming
the 3rd is tacit and not a train. - Original Message - From: Marshall Lochbaum To: programm...@jsoftware.com Cc: Sent: Wednesday, November 19, 2014 10:29 PM Subject: Re: [Jprogramming] Boxing columns None of these beat Roger's by your criteria, but here are a few: (,,.)&.>/ i.3 3 <"_

Re: [Jprogramming] Correct behavior of "e." ?

2014-11-20 Thread &#x27;Pascal Jasmin&#x27; via Programming
has to do with the definition of item 0 1 e. i. 2 2 1 1 3 e."0 1 i. 2 2 1 1 1 e."1 i. 2 2 1 0 - Original Message - From: Devon McCormick To: J-programming forum Cc: Sent: Thursday, November 20, 2014 1:19 PM Subject: [Jprogramming] Correct behavior of "e." ? Hi - I was

Re: [Jprogramming] Split on first found character

2014-11-25 Thread &#x27;Pascal Jasmin&#x27; via Programming
The spec (Fasta) can be revised to splitting on all LFs, where the first box is the control data, and subsequent boxes are the package. http://rosalind.info/glossary/fasta-format/ If so, you can grab all of the records from the sample link with this expression (copy records on clipboard, uses j

Re: [Jprogramming] Get unique results each time you use deal and roll

2014-11-28 Thread &#x27;Pascal Jasmin&#x27; via Programming
9!:45 will set the seed. J on startup has the same seed. For the default generator, 9!:45 will take a long array as the seed (basically a polynomial representation of a 19000 bit number) If you use the first random number generator (gbflip), the seed is a 31bit number. I've posted ways to get

Re: [Jprogramming] Emscripted J

2014-11-29 Thread &#x27;Pascal Jasmin&#x27; via Programming
the interop functionality isn't quite exposed in the UI, but typing the following in the "J window" will draw to canvas 'drawRect' (15!:0) (10,10,10,10) - Original Message - From: Joe Bogner To: programm...@jsoftware.com Cc: Sent: Saturday, November 29, 2014 1:47 PM Subject: Re: [Jpro

Re: [Jprogramming] Hexadecimal conversion

2014-12-01 Thread &#x27;Pascal Jasmin&#x27; via Programming
In J8, there are profile entries: hfd and dfh. Its available in addons for earlier versions. hfd 15 17 0f 11 hfd 15 f - Original Message - From: Jon Hough To: "programm...@jsoftware.com" Cc: Sent: Monday, December 1, 2014 10:24 AM Subject: [Jprogramming] Hexadecimal convers

Re: [Jprogramming] Modifying x inside Infix

2014-12-02 Thread &#x27;Pascal Jasmin&#x27; via Programming
The argument to 4 u\ y will be entirely y, and u is monadic. you can do something like this though: 2 (3&+)\ i.5 3 4 4 5 5 6 6 7 If you can change your spec to "updating y" on every iteration, and you want to apply to: x1 u (x2 u y) then you can make a table where x1, x2 and y are the 3

Re: [Jprogramming] Modifying x inside Infix

2014-12-02 Thread &#x27;Pascal Jasmin&#x27; via Programming
If you use your x as y, and y as x, then one argument has length 4 while the other length 1, and producing a length 1 result, then it fits the requirement for boxscan. boxscan =: ((&.>)/)(>@:) 1 (, <)~ |. <"1 i.4 4 ┌───┬─┬───┬───┬─┐ │12 13 14 15│8 9 10 11│4 5 6 7│0 1

Re: [Jprogramming] Pad Arrays for XORing

2014-12-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
,: will pad whatever side is shortest (i.5) ,: i.3 0 1 2 3 4 0 1 2 0 0 for xor (i.5) (22 b.)/@:,: i.3 0 0 0 3 4 - Original Message - From: Jon Hough To: "programm...@jsoftware.com" Cc: Sent: Wednesday, December 3, 2014 7:56 PM Subject: [Jprogramming] Pad Arrays for XORing If

Re: [Jprogramming] Pad Arrays for XORing

2014-12-03 Thread &#x27;Pascal Jasmin&#x27; via Programming
if xoring bits, yes. When the word pad comes up in the same sentence, I thought you might want to xor bytes. - Original Message - From: Jon Hough To: "programm...@jsoftware.com" Cc: Sent: Wednesday, December 3, 2014 8:19 PM Subject: Re: [Jprogramming] Pad Arrays for XORing Should I

Re: [Jprogramming] J and data analysis/relational algebra

2014-12-07 Thread &#x27;Pascal Jasmin&#x27; via Programming
select where u is (] #~ u) fromthis joins can be a bit tricky (though as Chris mentioned you can consider jd or jdb). You can also look up inverted tables on wiki. Some extra options in J when working with data is to separate your tables by data type so that you have a lot of 1 to 1 relation

[Jprogramming] A neat OOP trick with adverbs

2014-12-08 Thread &#x27;Pascal Jasmin&#x27; via Programming
adverbs can return nouns, though most are designed to return a verb. 1 : 'm + y' NB. a verb because it accesses y 1 : 'u 2' NB. returns a noun because it doesn't access y even though it uses a verb as adverb parameter Consider this noun producing adverb, A_z_ =: 1 : 'a =: u a' its defined in

Re: [Jprogramming] A neat OOP trick with adverbs

2014-12-09 Thread &#x27;Pascal Jasmin&#x27; via Programming
Placing this in a file and then loading coclass 'myclass' a =: 2 NB. member variable inside class or object. Noun intended. A =: 1 : ' a=: u a' NB. adverb that will modify member variable in console (base locale) you can do: a =. conew 'myclass' NB. a is variable in base locale +: A__a 4 3

Re: [Jprogramming] Calling Command line tools from J

2014-12-13 Thread &#x27;Pascal Jasmin&#x27; via Programming
the jtask locale is loaded by default. launch fork and spawn are the main functions. From: Jon Hough To: "programm...@jsoftware.com" Sent: Sunday, December 14, 2014 1:26 AM Subject: [Jprogramming] Calling Command line tools from J If I want to call a comma

Re: [Jprogramming] "Such that" syntax in J

2014-12-27 Thread &#x27;Pascal Jasmin&#x27; via Programming
It seems that "such that" is indistinguishable (to me) with select. While I do not use a "select" utility adverb (I write out a # expression each time), making these utility adverbs is a great step in learning J, and making the language fit the concepts you already understand in your mind. Wit

[Jprogramming] variable integer coding (challenge)

2014-12-29 Thread &#x27;Pascal Jasmin&#x27; via Programming
A common design decision is how large to make a field. For many numbers, we think that a byte will be large enough to hold practical values, but one day we will find out that it is not. This is essentially the Y2k problem, or year 2032 issue. A simple variable integer coding (tied to byte ran

Re: [Jprogramming] variable integer coding (challenge)

2014-12-29 Thread &#x27;Pascal Jasmin&#x27; via Programming
allenge) Here's a faster version of toVint, for at least some right arguments: toVint2=: [: (({."1 ,. 1:) #&, 255 ,. {:"1) 0 255 #: ] Here's an implementation of fromVint: fromVint=: 255&~: +/;.2 ] Thanks, -- Raul On Mon, Dec 29, 2014 at 12:12 PM, 'Pascal Ja

Re: [Jprogramming] Repeated rolling dice

2014-12-29 Thread &#x27;Pascal Jasmin&#x27; via Programming
> > >d6=:1 + ? bind 6 >> >> > >repd6=: [:+/(,d6)^:(6={:)@d6 >> >> > > >> >> > > Here's a variation on Roger Hui's approach, for the case where we >> >> > > want N values from our result: >> >> >

Re: [Jprogramming] variable integer coding (challenge)

2014-12-29 Thread &#x27;Pascal Jasmin&#x27; via Programming
─┬──┐ │abc│defg│hj│ └───┴┴──┘ - Original Message - From: Raul Miller To: Programming forum Cc: Sent: Monday, December 29, 2014 12:44 PM Subject: Re: [Jprogramming] variable integer coding (challenge) Here's a faster version of toVint, for at least some right arguments: toVint2=:

Re: [Jprogramming] variable integer coding (challenge)

2014-12-30 Thread &#x27;Pascal Jasmin&#x27; via Programming
I had to remind myself about the size of integers (4 bytes) on 32-bit. Will this only save space on numbers less than 1019? NB. 4 bytes toVint2 1019 255 255 255 254 NB. 5 bytes toVint2 1020 255 255 255 255 0 Are you looking for the savings in terms of disk space (saving it to a file) or worki

Re: [Jprogramming] variable integer coding (challenge)

2014-12-31 Thread &#x27;Pascal Jasmin&#x27; via Programming
would be reduced for storage but I'd have to test to see how much memory would be used on different operations. I'd be interested in the performance of operations like searching (e.g. find all the rows with a country of Germany) It might also be a safer way of storing user-input text with

Re: [Jprogramming] variable integer coding (challenge)

2014-12-31 Thread &#x27;Pascal Jasmin&#x27; via Programming
test to see how much memory would be used on different > operations. I'd be interested in the performance of operations like > searching (e.g. find all the rows with a country of Germany) > > It might also be a safer way of storing user-input text without > worrying about

Re: [Jprogramming] variable integer coding (challenge)

2014-12-31 Thread &#x27;Pascal Jasmin&#x27; via Programming
From: 'Pascal Jasmin' via Programming To: "programm...@jsoftware.com" Cc: Sent: Wednesday, December 31, 2014 11:40 AM Subject: Re: [Jprogramming] variable integer coding (challenge) base64 is essentially taking 3 bytes and storing them as 4. The inverse can take 4 6bit values an

[Jprogramming] an alternative to &. - and fun with conjunctions

2014-12-31 Thread &#x27;Pascal Jasmin&#x27; via Programming
A conjunction that returns an adverb and applies its 2 arguments before and after the adverb's parameter. B =: 2 : '(@: u)(v @:)' >: +:B -: 2 2.5 >: &.+: 2 2.5 >: dfh B hfd '1a' 1b The verbs are placed counterintuitively under the presumption that the u verb will be longer, and s

Re: [Jprogramming] During lulls in the games can you simplify this code?

2015-01-04 Thread &#x27;Pascal Jasmin&#x27; via Programming
elegance to me is having a one line version so as to avoid running multiple lines in order. the first chart is easy + table i.11 the basis for the second one is also pretty easy - table i.10 though you want to clean it of negative values ([: _:^:(0 > ])"0 -/~) i.10 0 _ _ _ _ _ _ _ _ _ 1

Re: [Jprogramming] During lulls in the games can you simplify this code?

2015-01-04 Thread &#x27;Pascal Jasmin&#x27; via Programming
actually there is a way to get something like the 2nd table with the default table adverb (i.10) _:^:(0 > ])@- table 4 + i.10 or _:^:(0&>)@- table 4 + i.10 - Original Message ----- From: 'Pascal Jasmin' via Programming To: "programm...@jsoftware.com"

Re: [Jprogramming] During lulls in the games can you simplify this code?

2015-01-04 Thread &#x27;Pascal Jasmin&#x27; via Programming
8 17 16 15 14 13 12 11 10 9 8│ >> │19│19 18 17 16 15 14 13 12 11 10 9│ >> │20│20 19 18 17 16 15 14 13 12 11 10│ >> └──┴─┘ >> >> postable differs from table in one significant way. After the results of >> the table have been fo

Re: [Jprogramming] Forward fill w/o looping

2015-01-05 Thread &#x27;Pascal Jasmin&#x27; via Programming
dyadic ;. is your usual friend in these cases. Though Raul has often found even more elegant approaches. a: (-.@= <;.1 ] )'Hi';'';'';'Ho';'';'hee';'';'';'haw';'';'';'Yo';'' ┌──┬─┬───┬───┬─┐ │┌──┬┬┐│┌──┬┐│┌───┬┬┐│┌───┬┬┐│┌──┬┐│ ││Hi│Hohee│haw│Yo│││ │└──┴┴┘

Re: [Jprogramming] Forward fill w/o looping

2015-01-05 Thread &#x27;Pascal Jasmin&#x27; via Programming
as a single more general function a: ;@:(] <@(# # {. );.1~ 1 (0}) -.@= )'';'Hi';'';'';'Ho';'';'hee';'';'';'haw';'';'';'Yo';'' 0 ;@:(] <

Re: [Jprogramming] Forward fill w/o looping

2015-01-05 Thread &#x27;Pascal Jasmin&#x27; via Programming
a verbed variation of Roger's (] (({.@:[ , #~) {~ +/\@:] ) [: * #&>) '';'Hi';'';'';'Ho';'';'hee';'';'';'haw';'';'';'Yo';'' - Original Message - From: Roger Hui To: Programming forum Cc: Sent: Monday, January 5, 2015 11:59 AM Subject: Re: [Jprogramming] Forward fill w/o looping

Re: [Jprogramming] variable integer coding (challenge)

2015-01-06 Thread &#x27;Pascal Jasmin&#x27; via Programming
8 bit) > >] packed=. #. _32[\ , #: 300 301 302 303 > 2.52152e9 4.02653e9 > >#. _9[\, #: packed > 300 301 302 303 0 0 0 0 > > > This may be elementary for some but I haven't worked at this level in > years so I enjoyed playing with it > > > &g

Re: [Jprogramming] Jd information

2015-01-06 Thread &#x27;Pascal Jasmin&#x27; via Programming
Perhaps there could be a warning that a key is needed on load 'jd' But a user could still go through the tutorial by not enforcing the key for purposes of hard coded tutorial file names. This would allow someone to look at JD while waiting for a key. No one would ever try to store real data in

Re: [Jprogramming] variable integer coding (challenge)

2015-01-06 Thread &#x27;Pascal Jasmin&#x27; via Programming
pproach: (32#2)#:_17998321 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1 Simplicity is a virtue? Thanks, -- Raul On Tue, Jan 6, 2015 at 12:44 PM, 'Pascal Jasmin' via Programming wrote: > I'm not sure this is the same problem, unless you are trying to en

  1   2   3   4   5   6   7   8   9   10   >