Re: [Jprogramming] Composite Item (m}y) with gerund m

2022-05-30 Thread 'Rob Hodgkinson' via Programming
Ditto Elijah, very nice indeed. FYI I have not seen this done so neatly in J before now, and there is a striking resemblance to that used in Kx (kdb+) via the “vector conditional construct”, described here: https://code.kx.com/q/ref/vector-conditional/ > On 30 May 2022, at 1:20 pm, Brian

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Don Guinn
I do this to get my directory a script is in: maindir=:'' maindir=:jpathsep z{.~>:1 i:~'/\' e.~z=.;(4!:4 <'maindir'){4!:3 '' On Mon, May 30, 2022 at 4:46 PM Jinwoo Lee wrote: > Sorry for the confusion. You're absolutely right. :) > > > On Mon, May 30, 2022 at 3:42 PM chris burke wrote: > > >

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Jinwoo Lee
Sorry for the confusion. You're absolutely right. :) On Mon, May 30, 2022 at 3:42 PM chris burke wrote: > A .jproj file is needed to define a project directory, but it is not needed > for folder names. > > A folder name is just a shortcut for a directory. If you define a folder > name for a

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread chris burke
A .jproj file is needed to define a project directory, but it is not needed for folder names. A folder name is just a shortcut for a directory. If you define a folder name for a directory, then after moving the code to another directory, you only need to update the folder name. On Mon, May 30,

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Jinwoo Lee
I actually use a slight variation of it. Because J defines '~Projects' in the default UserFolders_j_, I usually do something like: load '~Projects/myproj/foo.ijs' This works most of the time but if I ever rename the project folder to something else, I'd have to visit all such places and

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread chris burke
Right, but it depends on what you are doing. If writing an addon, then you could define: path=: jpath '~addons/zerowords/tgsjo' Otherwise, define a foldername and use that. On Mon, May 30, 2022 at 11:33 AM Raul Miller wrote: > On Mon, May 30, 2022 at 2:00 PM chris burke wrote: > > But if

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Hauke Rehr
I usually have some similar prelude to some of my scripts. And I dislike it. I always thought there are better ways I am unaware of and have been too lazy to look up/ask here. Am 30.05.22 um 18:37 schrieb Raul Miller: Well... you could use the approach used here (lines 11 through 17):

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Raul Miller
On Mon, May 30, 2022 at 2:00 PM chris burke wrote: > But if you want several scripts, you could load them without needing > tgsjopath like: > > load 'zerowords/tgsjo/tgsjoalias' In that example, that bit of code predates the use of the github addon mechanism. But, also, in some other cases we

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread chris burke
I would put all scripts into tgsjo.ijs so that this just needs: load 'zerowords/tgjsgo' But if you want several scripts, you could load them without needing tgsjopath like: load 'zerowords/tgsjo/tgsjoalias' The function tgsjopath extracts the full filename from 4!:3. Alternatively, J

Re: [Jprogramming] This week's episode of the ArrayCast podcast

2022-05-30 Thread Raul Miller
a=. 2 3 4 5 6 7 8 9 10 +/ .(*"4) 7 8 9 10 b=. ((*/2 3 4 5),6,(*/7 8 9 10)) +/ .(*"1) */7 8 9 10 a-:b 0 That said, it might be interesting to replace +/ with +/@, -- Raul On Mon, May 30, 2022 at 2:25 AM Elijah Stone wrote: > > That's reinforcing my point--there are no more than three

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Jinwoo Lee
Yeah, it'd work to add my own folder to UserFolders for a specific path. But I'd like to have a general solution that can be used in any files. Raul's solution seems to solve the problem. Thanks! Jinwoo On Mon, May 30, 2022 at 9:48 AM chris burke wrote: > Perhaps I misunderstand, but it

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Jinwoo Lee
Aha, 4!:3 and 4!:4 seem to be what I was missing. That's a nice trick. Thanks, Raul! But still, it would be nicer if J supports something like this out of the box :) Jinwoo On Mon, May 30, 2022 at 9:38 AM Raul Miller wrote: > Well... you could use the approach used here (lines 11 through

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread chris burke
Perhaps I misunderstand, but it looks like ~filefolder is that described in https://code.jsoftware.com/wiki/Guides/Folders_and_Projects . Note that folders can be defined on the fly, e.g. you could run UserFolders_j_=: UserFolders_j_,'filefolder';'/my/path' and then: jpath'~filefolder'

Re: [Jprogramming] jni - correction of dll name for Windows

2022-05-30 Thread bill lam
updated, please check. On Mon, May 30, 2022 at 11:21 PM wrote: > Hello, > > > The name of the dll for the Java virtual machine on Windows needs needs to > be corrected in jni.ijs (line 308): > > > > libjvm=. '"', '"',~ jvm, (('Darwin'-:UNAME) + >

Re: [Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Raul Miller
Well... you could use the approach used here (lines 11 through 17): https://github.com/zerowords/tgsjo/blob/master/tgsjo.ijs#L11 I hope this helps, -- Raul On Mon, May 30, 2022 at 11:58 AM Jinwoo Lee wrote: > > When my script file loads other files that I write, it would be very >

[Jprogramming] J path syntax for the current file's folder

2022-05-30 Thread Jinwoo Lee
When my script file loads other files that I write, it would be very convenient if we had a special jpath syntax for the folder that contains the current file. For example, let's say my script is at /my/path/foo.ijs, and it loads bar.ijs from the same folder. load 'bar.ijs' ... Or it loads

[Jprogramming] jni - correction of dll name for Windows

2022-05-30 Thread jph . butler
Hello, The name of the dll for the Java virtual machine on Windows needs needs to be corrected in jni.ijs (line 308): libjvm=. '"', '"',~ jvm, (('Darwin'-:UNAME) + IFUNIX){::'libjvm.dll';'libjvm.so';'libjvm.dylib' should be changed to: libjvm=. '"', '"',~ jvm, (('Darwin'-:UNAME) +

Re: [Jprogramming] Composite Item (m}y) with gerund m

2022-05-30 Thread Jan-Pieter Jacobs
I had some fun learning modifier trains recently (might post about my experiences later) and I came up with this adverb, based on Brian's second approach (no clue how to name it as I didn't bother understanding its purpose): adv=: ]: (]`(*@)`(,:([.].))}) 3&| adv ]`(*@(3&|))`(,: 3&|)} 3&|

Re: [Jprogramming] This week's episode of the ArrayCast podcast

2022-05-30 Thread Elijah Stone
On Mon, 30 May 2022, Elijah Stone wrote: The equivalent to 'rank', then, would specify a 'root' node within each array. (The rank conjunction, that is.) -- For information about J forums see

Re: [Jprogramming] This week's episode of the ArrayCast podcast

2022-05-30 Thread Elijah Stone
Einstein Summation Notation Not familiar with this specifically, but named axes have been suggested, and I was discussing them with somebody recently. I think they are an interesting idea, but do not like them; I think they are either noncompositional and error-prone or else so incapable as

Re: [Jprogramming] This week's episode of the ArrayCast podcast

2022-05-30 Thread 'robert therriault' via Programming
Thanks for the links to those postings by Roger and Marshall, Elijah. During the episode Marshall does refer to Einstein Summation Notation as a system that names the axes. https://en.wikipedia.org/wiki/Einstein_notation The other multidimensional primitives that I can think of are Shift and

Re: [Jprogramming] This week's episode of the ArrayCast podcast

2022-05-30 Thread Elijah Stone
That's reinforcing my point--there are no more than three significant axes there. a=. 2 3 4 5 6 7 8 9 10 +/ .(*"4) 7 8 9 10 b=. ((*/2 3 4 5),6,(*/7 8 9 10)) +/ .(*"1) */7 8 9 10 a -:&, b 1 On Mon, 30 May 2022, Raul Miller wrote: > On Mon, May 30, 2022 at 1:31 AM Elijah Stone wrote:

Re: [Jprogramming] This week's episode of the ArrayCast podcast

2022-05-30 Thread Raul Miller
On Mon, May 30, 2022 at 1:31 AM Elijah Stone wrote: > Rank is about projecting a 2- or 3-dimensional structure onto > multidimensional arrays. Those are common cases, but the concepts behind the notation do support operations like: $2 3 4 5 6 7 8 9 10 +/ .(*"4) 7 8 9 10 2 3 4 5 7 8 9 10