Re: [Jprogramming] trains

2014-07-18 Thread Gilles Kirouac
The first train I used has been given by Chris: getting the shape and the value (in a console, when you don't have a fancy GUI à la Dyalog). ($;]) a ┌─┬─┐ │1│0│ └─┴─┘ But, Daniel, have you looked at the Phrases? You'll find hundreds of them classified by application type in about fift

Re: [Jprogramming] trains

2014-07-18 Thread bill lam
You may use 5!:6 to guess an explanation. 5!:6<'f' and also for g h. On Jul 19, 2014 6:01 AM, "Linda Alvord" wrote: > Can you use a single phrase that explains this behavior? > >f=:(***)(***)(***) >g=:***(***)(***) >h=:(***)(***)*** > >3 (f-:g) 4 > 0 > >3 (f-:h) 4 > 1 > >

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread bill lam
There is another j ide written in javascript and python. search for qjide in jwiki and you may find something useful. Сб, 19 июл 2014, Jon Hough написал(а): > Well, my plam, which may be stupid, is to create a pythin, tkinter UI and > call j from this. > > --- Original Message --- > > From: "De

Re: [Jprogramming] trains

2014-07-18 Thread 'Pascal Jasmin' via Programming
putting spacing for fork groups  g is equivalent to  (* * (* (* * *) (* * *))) From: Don Guinn To: Programming forum Sent: Friday, July 18, 2014 10:15:02 PM Subject: Re: [Jprogramming] trains In the case of f you have three forks - each (***) which  combine

Re: [Jprogramming] trains

2014-07-18 Thread Linda Alvord
There is a characteristic of J to explain why they differ. Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Don Guinn Sent: Friday, July 18, 2014 10:15 PM To: Programming forum Subject: Re: [Jprogrammin

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Jon Hough
Well, my plam, which may be stupid, is to create a pythin, tkinter UI and call j from this. --- Original Message --- From: "Devon McCormick" Sent: July 19, 2014 1:01 PM To: "J-programming forum" Subject: Re: [Jprogramming] Calling j.dll from python For what you want to do, could you do it the

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Devon McCormick
For what you want to do, could you do it the other way around: call Python from J? Or, alternatively, invoke J on a command-line from Python? On Fri, Jul 18, 2014 at 10:31 PM, Jon Hough wrote: > I slightly modified the python script in the link (I removed references to > odedell, whatever that

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Jon Hough
I slightly modified the python script in the link (I removed references to odedell, whatever that is, and I called thecdll.LoadLibrary(...) Here are my very minor edits: import operatorfrom ctypes import * IDEN="jcmd_python" def mulall(arr):return reduce(operator.mul,arr,1)def run_jcmd( js):

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Joe Bogner
Jon - it's trickier than I thought. I have a partial implementation working that I can tinker with tomorrow You need to use WinDLL on windows to get the calling convention right J = WinDLL("c:/users/jbogner/downloads/j801_win32/bin/j.dll") jt = J.JInit() J.JDo(jt, "A=:i.5") Out[34]: 0 see http

Re: [Jprogramming] trains

2014-07-18 Thread Don Guinn
In the case of f you have three forks - each (***) which combine to make a fork. In the case of g you have the two (***) combined with the last * not in parens making a fork which then combines with the other two * making a fork. The outer parens show that middle fork. On Fri, Jul 18, 2014 at 7:

Re: [Jprogramming] trains

2014-07-18 Thread Linda Alvord
I'm really looking for an explation for why they are different. A concept that will explain the difference. Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Don Guinn Sent: Friday, July 18, 2014 6:08 PM

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Jon Hough
I am interested in calling J specifically from Python, preferably on Linux and Windows (and Mac). As Joe suggested, I've tried playing with jdll.ijs. I still can't get JGetM to work, but I'll have another bash at it later today. Thanks! > From: bbill@gmail.com > Date: Sat, 19 Jul 2014 07:27:0

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread bill lam
Set and get data using j.dll can be quite involving. If you use windows, it is much easier you to use to ole/com interface, search jwiki for more info. Note that j8 only support the jdllserver interface. On 18.07.2014, at 23:05, Jon Hough wrote: > Thanks, > My test script, so far, is > > fr

Re: [Jprogramming] trains

2014-07-18 Thread Don Guinn
g is equivalent to **(*(***)(***)) On Fri, Jul 18, 2014 at 4:00 PM, Linda Alvord wrote: > Can you use a single phrase that explains this behavior? > >f=:(***)(***)(***) >g=:***(***)(***) >h=:(***)(***)*** > >3 (f-:g) 4 > 0 > >3 (f-:h) 4 > 1 > >3 (g-:h) 4 > 0 > > Linda

Re: [Jprogramming] trains

2014-07-18 Thread Linda Alvord
Can you use a single phrase that explains this behavior? f=:(***)(***)(***) g=:***(***)(***) h=:(***)(***)*** 3 (f-:g) 4 0 3 (f-:h) 4 1 3 (g-:h) 4 0 Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@for

Re: [Jprogramming] trains

2014-07-18 Thread Kip Murray
Some trains for sets: NB. Set is a sorted numeric list with no duplicates. NB. Match -: tests set equality. set =: [: /:~ ~. NB. Create set un =: [: set ,NB. Union sd =: -. un -.~ NB. Symmetric Difference nt =: un -. sdNB. Intersection so =: ] -: un NB. Te

Re: [Jprogramming] trains

2014-07-18 Thread Linda Alvord
What is 10 people are playing bingo. After 15 numbers are drawn and "I win" is called, can't more than 1 person win? Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller Sent: Friday, July 18

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread chris burke
> I am wondering what is the edit-run paradigm in JQt 8.02. In J 602, I select and run. However, in JQt 802, it seems I have to create a script file and then run it from the ijs as part of the project. Thanks for pointing it out. Run selection is now only in Edit, and I'll add it to Term. On Fr

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread Raul Miller
Maybe. Note that http://rosettacode.org/wiki/Universal_Turing_machine#J assigns 'noun' using =. and if that is using an explicit J verb (such as 'load' or 'require') that means that that definition is temporary. In other words it's quite possible that the definition reverts to the standard defini

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread Yuvaraj Athur Raghuvir
I am wondering what is the edit-run paradigm in JQt 8.02. In J 602, I select and run. However, in JQt 802, it seems I have to create a script file and then run it from the ijs as part of the project. Also, when I tried to copy paste the above code and run it in J802, it hangs as it gets into the e

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread Aai
Here's an example that works with J802/JQt (mind line wrapping) ".@(('utm=. '),,)@(];._2)@(noun=. ".@('(0 : 0)'"_))_ NB. Fixed tacit universal Turing machine code... (((":@:(]&:>)@:(6&({::)) ,: (":@] 9&({::))) ,. ':'"_) ,. 2&({::) >@:(((48 + ]) { a."_)@[ ; (] $ ' '"_) , '^'"_) 3&({::))@:

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread Thomas Costigliola
Yuvaraj, make sure the definition of noun is being overwritten with the one given in the Turing machine definition. Type noun in your session, you should get this: noun ".@('(0 : 0)'"_) On Fri, Jul 18, 2014 at 1:26 PM, Thomas Costigliola wrote: > 'noun' and 'utm' are defined in the scrip

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread Thomas Costigliola
'noun' and 'utm' are defined in the script given. On Fri, Jul 18, 2014 at 12:34 PM, Raul Miller wrote: > What is your definition of "noun"? > > Here's what I get in a fresh j802 session: > >noun _ > |syntax error > > Thanks, > > -- > Raul > > > On Fri, Jul 18, 2014 at 1:19 AM, Yuvaraj Athu

Re: [Jprogramming] trains

2014-07-18 Thread chris burke
Often useful with link: (#;$;]) i.3 4 +-+---+-+ |3|3 4|0 1 2 3| | | |4 5 6 7| | | |8 9 10 11| +-+---+-+ On Wed, Jul 16, 2014 at 1:26 PM, 'Dan Baronet' via Programming < programm...@jsoftware.com> wrote: > I am looking for good examples of use of trains. > Apart

Re: [Jprogramming] trains

2014-07-18 Thread Raul Miller
'Keep' (or 'keep') is nice and short. I like when the name is shorter than the code. Thanks, -- Raul On Jul 18, 2014 1:15 PM, "Alex Giannakopoulos" wrote: > Yes, Linda, sorry for the typo. Should be > keep =: [-.-. > > No, Raul, I expressed myself badly. I was not implying that commutati

Re: [Jprogramming] trains

2014-07-18 Thread Alex Giannakopoulos
Yes, Linda, sorry for the typo. Should be keep =: [-.-. No, Raul, I expressed myself badly. I was not implying that commutative intersection on bags makes sense (or otherwise). What I was _trying_ to say, is that if the arguments are not sets, then the fork makes more sense to be called 'keep

Re: [Jprogramming] trains

2014-07-18 Thread Raul Miller
I am trying to think of a case where commutative intersect on bags makes sense. It seems to me that in any case where I want commutativity for that kind of operation I'd want to be working with either a unique list of elements. Do you have any counter-examples? (Another approach might be somethi

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread Raul Miller
What is your definition of "noun"? Here's what I get in a fresh j802 session: noun _ |syntax error Thanks, -- Raul On Fri, Jul 18, 2014 at 1:19 AM, Yuvaraj Athur Raghuvir wrote: > Hello, > > I was checking the tacit Turing Machine written by Jose Mario Quintana at > http://rosettacode.or

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Joe Bogner
The clue is here: JGetM i x *c *x *x *x *x''e p n t r s d'=. cmd cd pJ,(,y);4#<,0 Read up on this: http://www.jsoftware.com/help/user/call_procedure.htm Try running the jdll.ijs and playing with it (adding smoutput in various places) to understand what it's doing The string i x *c *x *x *x *x

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Jon Hough
Thanks, My test script, so far, is from ctypes import * cdll.LoadLibrary("j801/bin/libj.so") j = CDLL("j801/bin/libj.so") jt = j.JInit() j.JDo(jt, "a =: 1") a =j.JGetM( "a") print a This returns 4, even though I set a to be 1. I'm assuming 4 is the number of bytes returned (i.e. an int)??(

Re: [Jprogramming] trains

2014-07-18 Thread Tracy Harms
On Jul 16, 2014 10:49 PM, "Marshall Lochbaum" wrote: > > It's weird to ask for an example of a train since forks are such a > common part of J. If you look at almost any substantial piece of code > you'll be swimming in them in short order. > > Marshall I had the same reaction. Trains are the def

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Jon Hough
Joe, thanks. Your suggestion seems to work. However JGets seems to not exist.How do I then get the variable, once assigned? I tried to search through the .so/.dll for "get" functions: nm -g libj.so | grep Get Although jdll.ijs seems to contain jget, when I tried to call this (in Python) I get "

[Jprogramming] J Conference Proceedings

2014-07-18 Thread mikel paternain
Remember, JoJ (Journal Of J) will publish Conference proceedings in a special August issue !! In this occasion, we would like to prepare a very special editionin "book" format. For this reason send your contributions as soon is possible,after or before Conference. The deadline is August-15 and

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Joe Bogner
JGetM is what you need, but I strongly suggest reviewing http://jsoftware.com/wsvn/addons/trunk/general/misc/jdll.ijs (or your local version) to get a better understanding of how things work This part addresses your question: jget=: 3 : 0 cmd=. libj,' JGetM i x *c *x *x *x *x' 'e p n t r s d'=. c

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Jon Hough
Please ignore the last sentence from my previous email. Copied and pasted by accident. > From: jgho...@outlook.com > To: programm...@jsoftware.com > Date: Fri, 18 Jul 2014 15:50:41 +0100 > Subject: Re: [Jprogramming] Calling j.dll from python > > Joe, thanks. Your suggestion seems to work. > How

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Joe Bogner
JInit() returns the instance that you need to invoke against see addons/general/misc/jdll.ijs jdo is defined as: jdo=: 3 : 0 (libj,' JDo i x *c') cd pJ, boxopen y ) so I suspect you need to be passing that pointer address with python too... jt = j.JInit() j.JDo(jt, "x =: 3") [untested]

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Thomas Costigliola
Bill, Jon, sorry if that suggestion did not apply. I remembered it was a common pitfall when calling from C. Maybe that is not the case now. On Fri, Jul 18, 2014 at 10:29 AM, Jon Hough wrote: > My previous email was regarding Windows (7 with J801) > I just tried to do the same in Ubuntu (J801)

[Jprogramming] nothing

2014-07-18 Thread Raul Miller
Hand typed rather than cut&paste, because reasons. Excuse any typos. i.16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 *:i.16 0 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 7http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Jon Hough
My previous email was regarding Windows (7 with J801) I just tried to do the same in Ubuntu (J801) cdll.LoadLibrary("j801/bin/libj.so") j = CDLL("j801/bin/libj.so")>>> j.JInit()158010848 No idea what the above output means. Is that the pointer address of something? And then: >>> j.JDo("x =: 3")Seg

Re: [Jprogramming] trains

2014-07-18 Thread Linda Alvord
Since [. Is not in the vocabulary list your verb, keep, must be a typo. Here's my idea: ht=:'Hello there!' vowels=:'aeiouAEIOU' keept2=: 13 :'(x e. y)#x' ht keep2 vowels eoee keep2 e. # [ Linda -Original Message- From: programming-boun...@forums.jsoftware.com

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread bill lam
>From which resource did you learn that(not python)? It should be very out dated. On Jul 18, 2014 6:00 PM, "Jon Hough" wrote: > I am trying to call jdll.JDo from python but I get the error message, > access violation. > > Here is my python. > > Cdll.LoadLibrary(path to j.dll) > J =CDLL(path to j.

Re: [Jprogramming] Calling j.dll from python

2014-07-18 Thread Thomas Costigliola
Hi, Jon, are you calling JInit first? You have to make sure you call that before JDo. On Fri, Jul 18, 2014 at 6:00 AM, Jon Hough wrote: > I am trying to call jdll.JDo from python but I get the error message, > access violation. > > Here is my python. > > Cdll.LoadLibrary(path to j.dll) > J =CDL

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread Aai
Works fine for me. J802 /JQt On 18-07-14 07:19, Yuvaraj Athur Raghuvir wrote: Hello, I was checking the tacit Turing Machine written by Jose Mario Quintana at http://rosettacode.org/wiki/Universal_Turing_machine#J (also referred in Oct 2013 edition of Journal of J) When I use J 802 with JQt, t

Re: [Jprogramming] trains

2014-07-18 Thread Alex Giannakopoulos
Just a teeny comment if I may: The "set intersection" fork posted above ([-.-.) whilst quite valid for sets is not commutative on 'bags', i.e. collections which may have repeats. There, it acts more as a "retain" or "keep" verb, the opposite - so to speak - of "less" (-.) ht =. 'Hello there!'

Re: [Jprogramming] Error executing Rossetta Code for Turing Machine in J802

2014-07-18 Thread Don Guinn
First you use a colon, not a semicolon to make an explicit definition. Second (noun _) is an invalid combination. I tried it in J6 and it failed. On Thu, Jul 17, 2014 at 11:19 PM, Yuvaraj Athur Raghuvir < yuvaraj@gmail.com> wrote: > Hello, > > I was checking the tacit Turing Machine written

Re: [Jprogramming] Discarding unneeded dimensions

2014-07-18 Thread Linda Alvord
%:2 1.41421 A=:i.1 4 1 4 2 1 f=: 13 :'i.(1~:$y)#$y' ]B=:f A 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 f [: i. $ #~ 1 ~: $ Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:progr

[Jprogramming] Calling j.dll from python

2014-07-18 Thread Jon Hough
I am trying to call jdll.JDo from python but I get the error message, access violation. Here is my python. Cdll.LoadLibrary(path to j.dll) J =CDLL(path to j.dll) J.JDo("x =: i. 3") This gives am error. In fact any string gives the error. J.JGet doesnt seem to give errors, but since I cannot s

Re: [Jprogramming] a zoom function (doubling points accross rows and columns)

2014-07-18 Thread Linda Alvord
Sorry about the +, it slipped away too fast. no=: 13 :'(0{y)#"1(1{$y)#y' no i.2 3 1 2 2 1 2 2 1 2 2 4 5 5 4 5 5 4 5 5 z=: 13 :'(1{y)#"1(0{$y)#y' z i.2 3 0 0 0 1 1 1 1 2 2 2 2 2 0 0 0 1 1 1 1 2 2 2 2 2 3 3 3 4 4 4 4 5 5 5 5 5 3 3 3 4 4 4 4 5 5 5 5 5 z (1 { ]) #"1 ]

Re: [Jprogramming] a zoom function (doubling points accross rows and columns)

2014-07-18 Thread Linda Alvord
no=: 13 :'(0{y)#"1(1{$y)#y' +no i.2 3 1 2 2 1 2 2 1 2 2 4 5 5 4 5 5 4 5 5 z=: 13 :'(1{y)#"1(0{$y)#y' z i.2 3 0 0 0 1 1 1 1 2 2 2 2 2 0 0 0 1 1 1 1 2 2 2 2 2 3 3 3 4 4 4 4 5 5 5 5 5 3 3 3 4 4 4 4 5 5 5 5 5 -Original Message- From: programming-boun...@forums.