Re: [Jprogramming] Problem writing files

2015-12-03 Thread Alex Giannakopoulos
Ah, OK, Joe, I think I see what the problem is. If I simply write a quoted string to the file it works fine. E.g. 1!:21 <'testfile' 30029424 'hello' 1!:2 (30029424) However I was trying to dump non-string variables, viz. tables, which is what it didn't like. E.g. f1 =.1!:21 <'testfile

[Jprogramming] Problem writing files

2015-12-03 Thread Alex Giannakopoulos
I am using J 8.02 under 64-bit Linux (Mint) Whenever I try to write a file, even just a simple line or two of text, I get a file full of illegible binary. This happens regardless of whether I use the 'jfile' system, or the foreigns 1 !: 21 etc Are there any known problems in this area, or am

Re: [Jprogramming] sorting a table by nth column

2015-12-03 Thread Alex Giannakopoulos
Thanks, that's brilliant. Funnily enough, I'd read the relevant page on /: and had tried something very similar, but for some reason, it didn't work. Can't remember exactly what. Anyway it's good to see that I wasn't too many miles off the track, appreciated! (Works identically with boxed t

[Jprogramming] sorting a table by nth column

2015-12-03 Thread Alex Giannakopoulos
Even though I've been using J lightly for a quite while, I have not so far had cause to use boxing, especially boxed tables. Great feature, if you need it, but I'm struggling a bit to get up to speed. Say I have a two column table such as would be generated by ([;somefunction)"0 i.100 How wo

Re: [Jprogramming] J Kernel

2014-09-02 Thread Alex Giannakopoulos
Just a teeny thing, but if you are going to have both the monadic and the dyadic definitions for ^. then shouldn't you have the same for ^ ? Less confusion that way, plus a better insight into the way J uses dyads. On 2 September 2014 22:14, Henry Rich wrote: > What I meant was, arrange so G

Re: [Jprogramming] SQLite

2014-08-28 Thread Alex Giannakopoulos
Many thanks for that Bill! On 28 August 2014 14:09, bill lam wrote: > Please elaborate how the shader demo in qt demo of j802 failed. > It didn't! I have just seen it and it seems to work fine, Pleased about that - at least I've got something to go on now. > opengl 1.x had been decommitted.

Re: [Jprogramming] SQLite

2014-08-28 Thread Alex Giannakopoulos
On 28 August 2014 13:26, Raul Miller wrote: > Something that "works out of the box" and "linux" is unlikely given > the current state of things. > Too true, too often... Hope everything turns out OK. -- For information about J f

Re: [Jprogramming] SQLite

2014-08-28 Thread Alex Giannakopoulos
aul Miller wrote: > On Thu, Aug 28, 2014 at 7:23 AM, Alex Giannakopoulos > wrote: > > I have to say that one of my greatest frustrations with J is that a lot > of > > good work of the past seems to get lost in the process of updates. > > E.g. I was really looking forward

[Jprogramming] SQLite

2014-08-28 Thread Alex Giannakopoulos
Does anyone know what the current state of play is with regard to SQLite support? The documentation under jwiki/Addons/data/sqlite is not valid anymore, and PacMan only offers a data/ddsqlite, which however does not seed to be documented anywhere. I have to say that one of my greatest frustratio

Re: [Jprogramming] Memoizing (Project Euler problem 14)

2014-08-06 Thread Alex Giannakopoulos
My apologies if I've missed it, but has anyone posted how long the vector approach takes to find the longest chain under 100 and the highest number in that chain? The answers are - longest chain: 837799 ; steps: 524 ; biggest number in chain: 2974984576 I am also not completely clear on the ve

Re: [Jprogramming] Memoizing (Project Euler problem 14)

2014-08-05 Thread Alex Giannakopoulos
> In other words, it (M.) does seem to be working. But it can only do so much. Thanks for that Raul. Obliged, as ever. I suppose if one wanted total reliability in this respect, it would be best to write one's own memoization routine (probably still an adverb, though). OK, back to re-installing

Re: [Jprogramming] Memoizing (Project Euler problem 14)

2014-08-04 Thread Alex Giannakopoulos
Basically, in case it's not obvious, colchain is returning a vector of two values, 1) the number of steps that particular sequence takes and 2) the largest nuber present in that sequence (hence the x:). On 5 August 2014 00:11, Alex Giannakopoulos wrote: > On 4 August 2014 23:52, Rau

Re: [Jprogramming] Memoizing (Project Euler problem 14)

2014-08-04 Thread Alex Giannakopoulos
On 4 August 2014 23:52, Raul Miller wrote: > Do you mean > Yes, I do :) > colchain =: 3 : 0 M. > if. y=2 do. 1,2 > else. chain=. colchain nextcol y > (>:0{chain),x:y>.1{chain > end. > ) > > If so, that is an incomplete definition - x is a global variable in > colchain. > Is it? It's n

Re: [Jprogramming] Memoizing (Project Euler problem 14)

2014-08-04 Thread Alex Giannakopoulos
Raul said: > It probably would be nice to have something like an ML-flavored compiler > for some subset of J. Getting a bit off-topic now and into the realms of "Chat", but I totally agree that we (well, I certainly do) need some fusion of the twain. Something ML-stylee to do the recursive stuff (

Re: [Jprogramming] Memoizing (Project Euler problem 14)

2014-08-04 Thread Alex Giannakopoulos
On the subject of memoizing, I'd be curious to know why the colchain verb I tried above (post 20h12) does not seem to work with M. whereas, say, the fib example given in the Voc does. I have copied the syntax almost identically.

Re: [Jprogramming] Memoizing (Project Euler problem 14)

2014-08-04 Thread Alex Giannakopoulos
Hm, interesting approach, that of Roger's, I still haven't digested it all, but sometimes it would be nice to be able to tackle these problems the same as everybody else in the world... On 4 August 2014 20:12, Alex Giannakopoulos wrote: > I used the following memoized code, >

Re: [Jprogramming] Memoizing (Project Euler problem 14)

2014-08-04 Thread Alex Giannakopoulos
I used the following memoized code, nextcol =: 3 : 0 if. 0=2|y do. -: y else. >: 3*y end. ) colchain =: 3 : 0 M. if. y=2 do. 1,2 else. chain=. colchain nextcol y (>:0{chain),x:y>.1{chain end. ) but it took forever to generate the following I aborted it. colchain"0 (2}.i.101) I

Re: [Jprogramming] trains

2014-07-18 Thread Alex Giannakopoulos
nt, but I can't think of > how to make that kind of thing commutative.) > > Anyways, for commutativity with bags, I think I'd add ~. to the expression. > > Thanks, > > -- > Raul > > > > On Fri, Jul 18, 2014 at 8:38 AM, Alex Giannakopoulos > wrote: >

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] trains

2014-07-16 Thread Alex Giannakopoulos
way. IOW one dyadic and one monadic verb. (+!) 4NB. i.e. 4 + !4 28 If the hook is dyadic then we combine the result of the right verb on the right argument with the left argument, rather than with itself: 3 (+!) 4NB. i.e. 3 + !4 27 On 16 July 2014 22:12, Alex Giannakopoulos wrote

Re: [Jprogramming] trains

2014-07-16 Thread Alex Giannakopoulos
I suppose the most useful, from a beginner's point of view, is the cap fork, e.g. [: *: sin which allows composition, and is equivalent to *: @ sin Some people prefer this former notation as clearer than the latter. So, sin =: 1&o. cos =: 2&o. (([: *: sin) + [: *: cos) 9876543210 1 Basic

Re: [Jprogramming] Log base 10

2014-06-10 Thread Alex Giannakopoulos
gt; 0.0011087 18240 >timespacex '(10&^inv) ? 1000 $ 900' > 0.000245056 26304 >timespacex > 6!:2 , 7!:2@] > > time foreign conjunctions - > http://www.jsoftware.com/help/dictionary/dx006.htm > space foreign conjunctions - > http://www.jsoftware.com/hel

Re: [Jprogramming] Log base 10

2014-06-10 Thread Alex Giannakopoulos
Thanks Kip, as usual trying everything but the most obvious... On 10 June 2014 13:48, Kip Murray wrote: > Have you tried 10&^. ? See > http://www.jsoftware.com/docs/help801/dictionary/d201.htm > > On Tuesday, June 10, 2014, Alex Giannakopoulos > wrote: > > > Wh

[Jprogramming] Log base 10

2014-06-10 Thread Alex Giannakopoulos
Which of these two is the more efficient (if there's any difference) and is there any way way mere mortals can tell? log10 =: 10 %&^.~ ] logb10 =: 10&^inv Further, if I only wanted to find the order of a given +ve integer would it be better to do <. @ log10 (or <. @ logb10) or something like:

Re: [Jprogramming] Android Keyboard

2014-06-10 Thread Alex Giannakopoulos
Skip, I am glad you mentioned this. I've been suffering too. (It's not just Samsung, BTW, all Android devices have some sort of smart keyboard that interferes, even if they (the keyboards) are not always the same. My pet bugbear is reversion from the numerical to the non-numerical keyboard if th

Re: [Jprogramming] Indexing into array

2014-05-29 Thread Alex Giannakopoulos
9 May 2014 14:13, Alex Giannakopoulos wrote: > Ah, that's cool Michael, so that > {:: > is a shorthand or special code or something for > > ] {~ [: < [ > is it? > Handy... should be added to Voc/NewVoc > > > On 29 May 2014 13:38, Michael Dykman wrote: >

Re: [Jprogramming] Indexing into array

2014-05-29 Thread Alex Giannakopoulos
> 1 3 > 2 1 > > s {:: i. 4 4 > 7 9 > On May 29, 2014 8:18 AM, "Alex Giannakopoulos" > wrote: > > > Hm, nice that, especially the intersection feature > > > > (<2 1;1 3) { i. 4 4 NB. Select rows 2&1, columns 1&3 > >

Re: [Jprogramming] Indexing into array

2014-05-29 Thread Alex Giannakopoulos
Hm, nice that, especially the intersection feature (<2 1;1 3) { i. 4 4 NB. Select rows 2&1, columns 1&3 9 11 5 7 Maybe it's time that NewVoc was linked to the Help page in place of Voc. Certainly would have saved me a lot of time on more than one occasion. Will certainly be checking that f

Re: [Jprogramming] Boxing Unicode (display)

2014-05-09 Thread Alex Giannakopoulos
Thanks Ian, interesting thread. Danylo, sbox _sort of_ works, if I insert a space between each character. Messes up if there ARE spaces to display, though. Still, that sets me on the right track, I'm sure I can figure a workaround... sbox cutopen 'κ υ ά μ ω ν α π έ χ ε σ θ α ι' +-+-+-+-+-+-+-+

Re: [Jprogramming] Simple tacit verbs problem

2014-05-03 Thread Alex Giannakopoulos
Simple when you know how... On 3 May 2014 18:32, Alex Giannakopoulos wrote: > Thanks again, Joe. No I wasn't missing the picture in the box. Have > pored over it many times. > I just hadn't seen how the OP's initial formulation of a MONADIC verb as a > hook was bei

Re: [Jprogramming] Simple tacit verbs problem

2014-05-03 Thread Alex Giannakopoulos
omething dyadic. (x was now the initial y, and y was gx) then all was clear. Just FYI. I thought you might like the insight into the workings of the mind of a noob, since you went to all that trouble to help... On 3 May 2014 18:27, Alex Giannakopoulos wrote: > Yup, got it now. > ((m&

Re: [Jprogramming] Simple tacit verbs problem

2014-05-03 Thread Alex Giannakopoulos
formula, and the y was the whole of ((n&u) y)) Thanks all On 3 May 2014 18:13, Alex Giannakopoulos wrote: > @Joe: Thanks, I use the same notation for m,n,u,v,x and y (I'd have > thought it was obvious. So many other things seem to be around here...) > BTW, you are right i

Re: [Jprogramming] Simple tacit verbs problem

2014-05-03 Thread Alex Giannakopoulos
found this as useful and informative as I did. On 3 May 2014 17:06, Joe Bogner wrote: > > On 3 May 2014 14:22, Alex Giannakopoulos > wrote: > >> OK, but can't see which part of the docs clarifies that. > > Alex, the dictionary link that R.E. Boss shared, > http://ww

Re: [Jprogramming] Simple tacit verbs problem

2014-05-03 Thread Alex Giannakopoulos
pinion, as it could easily throw a newcomer. I.e. if the newcomer is still with us... On 3 May 2014 14:22, Alex Giannakopoulos wrote: > Hi R.E. - I don't know if that was meant to be an answer to me, but if it > was, I don't see how it covers it... sorry, maybe I'm being

Re: [Jprogramming] Simple tacit verbs problem

2014-05-03 Thread Alex Giannakopoulos
ginal Message- > > From: programming-boun...@forums.jsoftware.com [mailto:programming- > > boun...@forums.jsoftware.com] On Behalf Of Alex Giannakopoulos > > Sent: zaterdag 3 mei 2014 12:05 > > To: J Programming forum > > Subject: Re: [Jprogramming] Simple tacit ve

Re: [Jprogramming] Simple tacit verbs problem

2014-05-03 Thread Alex Giannakopoulos
Damn, I just tried prefixing a whole bunch of monadic verbs with an integer, and it did indeed apply them N many times. What's the point of the power function ^: then? More importantly, where exactly is this documented? J never stops surprising me, though sometimes I wonder if that's a good thin

Re: [Jprogramming] Simple tacit verbs problem

2014-05-03 Thread Alex Giannakopoulos
I've been caught by the hook in the *present* (and I thought I understood them!). My go-to example for hooks is a dyadic function followed by a monadic one: So for example, the monadic hook (+!) would be interpretted as argument + !argument which gives a nice intuitive meaning to (+!) , viz. the ar

Re: [Jprogramming] paarabola on graph paper

2014-04-24 Thread Alex Giannakopoulos
And yes, a way to set the vertical limits, without resorting to background "grids" would be good. Surely it must be hidden there somewhere? On 25 April 2014 07:34, Alex Giannakopoulos wrote: > Clarification: > Hm, actually it showed automatically the first time, but then nee

Re: [Jprogramming] paarabola on graph paper

2014-04-24 Thread Alex Giannakopoulos
Clarification: Hm, actually it showed automatically the first time, but then needed a pd 'show' for subsequent reruns, unless the plot window was closed. On 25 April 2014 07:20, Alex Giannakopoulos wrote: > Yup, interesting. > I would add, though, that in the simple example I g

Re: [Jprogramming] paarabola on graph paper

2014-04-24 Thread Alex Giannakopoulos
gt;pd (i:2j32);P >pd 'show' > > Finally, note that, if you prefer, > >require 'numeric' >steps _2 2 32 > > could have been used instead of i:2j32. > > (I am avoiding the use of the definition of 'do' for generating

Re: [Jprogramming] paarabola on graph paper

2014-04-24 Thread Alex Giannakopoulos
Here's a crude stab that I think does what you want. Thanks for the opportunity to dig into the plotting a bit! load 'plot' A=:steps _2 2 8 V=:j./~ A H=:|:|. V P=: 2 <. *: 'pensize 0; color 50 255 255' plot V,H pd 'pensize 2;color BLUE' pd (]+0j1*P) steps _2 2 32 On 25 April 2014 0

Re: [Jprogramming] paarabola on graph paper

2014-04-24 Thread Alex Giannakopoulos
Otherwise (having just looked in the Labs) I think the "pd" verb may allow you to plot different size data on the same plot. I haven't used it yet, I'll check it out now, but it may be what you need. On 25 April 2014 06:36, Alex Giannakopoulos wrote: > ... contd > &g

Re: [Jprogramming] paarabola on graph paper

2014-04-24 Thread Alex Giannakopoulos
... contd Using (]+0j1*P) or similar Also I think the intervals must be the same on one plot. If you try to mix an 8-interval with a 32-interval matrix, the 8-matrix will get padded with 0s or 0j0s, rendering a nice spider's web in the latter case. You will need to pad the 8-matrix with the val

Re: [Jprogramming] Matrix inverse query

2014-04-23 Thread Alex Giannakopoulos
Not a bad idea Raul, I still haven't installed it on any of my Android devices (phone or tablet) but am looking to do so. If that works I'd be more than happy to contribute whatever is within my abilities. On 23 April 2014 19:41, alexgian wrote: > Thanks Bob > > Nice call. I might start using

Re: [Jprogramming] (no subject)

2013-10-11 Thread Alex Giannakopoulos
Hit the nail on the head. Pattern matching is more useful in languages with logic variables, or at least lisp-style lists with heads and tails. I assume (hope anyway) that WL has such, else why even bother. Although I like the style of programming which supports such pattern matching, I have neve

Re: [Jprogramming] 13 : '(g^:x)y'

2013-09-21 Thread Alex Giannakopoulos
On 21 September 2013 16:06, Dan Bron wrote: > TL;DR: The last sentence of the Vocabulary entry for & is "The phrase x > f@[&0 y is equivalent to f^:x y , apply the monad f x times to y ." But if > you want to know why > > It breaks down like this:[...etc] > Thanks you for that most pain

Re: [Jprogramming] 13 : '(g^:x)y'

2013-09-21 Thread Alex Giannakopoulos
On 20 September 2013 13:02, Henry Rich wrote: > g@[&0 > It looks brilliant! But how on earth do you parse that?? Sure beats me. I'm happy with Ric's g@]^:[ -- For information about J forums see http://www.jsoftware.com/forum

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Alex Giannakopoulos
Thanks for pointing that out, Dan! On 15 September 2013 15:42, Dan Bron wrote: Now, while these two sentences are theoretically fungible, and &.": is cute, > in reality ":^:_1 is monad ". , which is dangerous (":^:_1 '1!:55 ...' > for > example). > > So, if I were going to apply this code to u

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Alex Giannakopoulos
Yup that did it! ":^:_1 'x',~ -.&' ' ": 1234567 456789 23345567 34446 12345674567892334556734446 Shoulda thought of it! Cheers, Raul! On 15 September 2013 14:40, Raul Miller wrote: > On Sun, Sep 15, 2013 at 9:34 AM, Alex Giannakopoulos > wro

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Alex Giannakopoulos
; > N > consider that there is only a single reference to the constant '/' (direct > or indirect), and then try and how you would express function in another > language w > > Please excuse typos; composed on a handheld device. > > On Sep 8, 2013, at 11:16 PM, Joey K

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
That 'less' verb is very useful, I'd never had occasion to use it until now! It could have been a bit more hyped up in the documentation, though, I'd never even seen it used before! (blush) On 9 September 2013 03:46, Alex Giannakopoulos wrote: > Ah, OK, now I

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
answers, but what I > see happening is that & is forcing the ' ' as the right argument. When you > supply your right argument it moves to the left side of -. and then the ' ' > (empty spaces) are removed. > > Hope this helps, bob > > On 2013-09-08, at 7:

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
of ;@cut > > -Dan > > Please excuse typos; composed on a handheld device. > > On Sep 8, 2013, at 10:07 PM, Alex Giannakopoulos > wrote: > > > Hi - I need to join up a list of integers (presented as a rank-1 array) > > into a single number. > > > >

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
place of ;@cut > > -Dan > > Please excuse typos; composed on a handheld device. > > On Sep 8, 2013, at 10:07 PM, Alex Giannakopoulos > wrote: > > > Hi - I need to join up a list of integers (presented as a rank-1 array) > > into a single number. > > > >

[Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
Hi - I need to join up a list of integers (presented as a rank-1 array) into a single number. At the moment I am using the following, ;@ cut &. ": which works, but I wonder if there is something better, not using the supplied 'cut' verb, which seems like overkill. Any suggestions hints pointers

Re: [Jprogramming] Ranks of left and right arguments (continued)

2013-03-24 Thread Alex Giannakopoulos
Ric wrote: >> Table (Dyadic insert) can also be useful here: >> 17 24 35 +/ i. 5 Crazy stuff, I like it! Ther'e always another way in J, isn't there? @ *Björn : That looks interesting, but I'm going to need /several/ whiskeys, before I even attempt to see what's happening there!* -

Re: [Jprogramming] Ranks of left and right arguments (continued)

2013-03-24 Thread Alex Giannakopoulos
Thanks Henry! >>17 24 35 +"0 1 i. 5 I can see that from the second example you provide that it was daft trying to change the rank of i, since it is actually + that needs this treatment. I.e. I could have made a verb r0addr1 =: +"0 1 and done (17 24 35 r0addr1 i.5). Cool. >>17

Re: [Jprogramming] Ranks of left and right arguments (continued)

2013-03-24 Thread Alex Giannakopoulos
Oops, sorry, meant "rotations" verb, of course. Long day. On 24 March 2013 17:52, Alex Giannakopoulos wrote: > Thanks to everyone who helped me sort out the "rotations" noun using |. " > 0 _ ] >

[Jprogramming] Ranks of left and right arguments (continued)

2013-03-24 Thread Alex Giannakopoulos
Thanks to everyone who helped me sort out the "rotations" noun using |. " 0 _ ] Further to this I have the following problem: I want to make an array of N rows, all starting at arbitrary values, each being a simple incremental sequence. So I can do this, for example by specifying the arbitrary va

Re: [Jprogramming] All rotations of a rank 1 vector

2013-03-23 Thread Alex Giannakopoulos
Thanks Henry, I was hobbling in that general direction... Amazing how simple it is when one "gets it", but I'd never had occasion to change rank of left argument before. -- For information about J forums see http://www.jsoftware.co

Re: [Jprogramming] All rotations of a rank 1 vector

2013-03-23 Thread Alex Giannakopoulos
Ah, is the |. " 0 1 ] setting the rank of the /left/ argument to 0? Lightbulb goes on! -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] All rotations of a rank 1 vector

2013-03-23 Thread Alex Giannakopoulos
Thanks Ric, that worked. In the end I used rots =: ] |." 0 1 ~ [:i.# which gives me what I want. Not quite sure I understand the |. " 0 1 ] bit, so I am using it cargo-cult stylee. I was previously trying |. " 0 there must be something I haven't grasped.

[Jprogramming] All rotations of a rank 1 vector

2013-03-23 Thread Alex Giannakopoulos
I need to get all the rotations of a rank-1 vector i.e from 10 11 12 to get 10 11 12, 11 12 10 and 12 10 11 say my vector is size 3, I tried: i.3 |. 10 11 12 but it spits out a length error, as, of course, does 0 1 2 |. 10 11 12 Trying to change the rank of rotate doesn't seem to help, not h

Re: [Jprogramming] What are 0: 1: and 2: ?

2013-03-14 Thread Alex Giannakopoulos
/help/**dictionary/dconsf.htm<http://www.jsoftware.com/help/dictionary/dconsf.htm> > > ... peter > > > On 03/14/13 18:40, Alex Giannakopoulos wrote: > >> I saw these operators, 0: and 2: in some code, and I can't quite make >> ou

[Jprogramming] What are 0: 1: and 2: ?

2013-03-14 Thread Alex Giannakopoulos
I saw these operators, 0: and 2: in some code, and I can't quite make out what they do, nor can I find any documentation. Any suggestions? -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] The farmer's fence

2013-02-23 Thread Alex Giannakopoulos
Checked the ellipses, turns out the maximum area is a circle after all, provided the wall is at least 200/π m. The area would be ±= 1591.549 m², unless anyone else knows better. -- For information about J forums see http://www.jsof

Re: [Jprogramming] The farmer's fence

2013-02-23 Thread Alex Giannakopoulos
Nice little gotcha there, assuming that the shape will be a square, since a square maximizes the contained area for a rectangle, while forgetting that the wall gives you extra perimeter for free, depending on the shape. By the same analogy I'd tackle Roger's version of the problem, i.e. find ANY

[Jprogramming] Recursive programming (verb under unbox)

2013-02-12 Thread Alex Giannakopoulos
Marshall Lochbaum wrote: > [this version of] > af uses a bit refactoring to avoid having to write the case where y is empty... Marshall I almost missed your post, just read it... I really like the way you use ^: as a replacement for recursion, but I had NO IDEA that the syntax you have used was r

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-11 Thread Alex Giannakopoulos
Raul: > After reading this, and finally noticing the comment about remel in > the original post, I am uncomfortable with this treatment of remel. > [...] > But the original code is not using an alist, as near as I can tell -- No, just a regular list as you correctly observed > or if > that's bec

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-11 Thread Alex Giannakopoulos
Big thanks to everybody that answered! I seem to have interleaved two quite different questions into one. 1) For those that answered how to find number of divisors without using recursion (esp. Aarie), much obliged. I was looking for that formula all over the place! 2) For those that answered re

[Jprogramming] (no subject)

2013-02-11 Thread Alex Giannakopoulos
Don Guinn wrote: > Also, the x and y in explicit definitions are local names so are unique > from x and y of a calling explicit definition. That includes recursion. Yes, I am aware of that, but what if I have a nested function, that is local to another, enclosing function? Is that even possible in

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-11 Thread Alex Giannakopoulos
Useful suggestions in general there, especially (M.), I'd missed it somehow, but not sure how they can help here. Essentially what I am looking for here is all the possible combinations of the prime factors. -- For information abo

[Jprogramming] Recursive programming (and scoping therein)

2013-02-11 Thread Alex Giannakopoulos
Are there any resources on recursive programming in J? Couldn't find much by searching. I would particularly like to know about scoping, and also so-called free variables. It seems to me that the enforced naming of variables as 'x' and 'y' might cause problems in nested functions, necessitating a

[Jprogramming] Re : Sigma notation

2012-12-22 Thread Alex Giannakopoulos
>> Lambda considered harmful? LOL > No, sigma considered harmful. and > Infinite series (products, etc.) best done by having infinite vectors. See [...] Thanks Roger, Always a pleasure to read your take on things! -- For informa

[Jprogramming] Re : Sigma notation

2012-12-21 Thread Alex Giannakopoulos
Very nice, Linda, thanks. That's just the example I needed. I think I'm beginning to get the 'geist' of it now! (Lambda considered harmful? LOL) -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] Re : Sigma notation

2012-12-21 Thread Alex Giannakopoulos
Brian, Well, yes, that is basically what my adverb is trying to generalize. However, I stress that I am not looking at this so much for my own use, but more in terms of how to present it to a student that has learnt or is learning sigma notation. +/ fn (start irange end) is OK, I suppose, but li

[Jprogramming] Sigma notation

2012-12-21 Thread Alex Giannakopoulos
Contemplating the use of J at elementary mathematical level, I was curious as to what the accepted approach for the sigma notation might be... After all, this is even present on calculators these days, and students expect something like it to be available. A site search - surprisingly - does not

Re: [Jprogramming] Promoting a vector to a matrix (changing rank)

2012-12-11 Thread Alex Giannakopoulos
Thanks Bob, Funnily enough, the problem I am trying to solve does involve "laminate"(,:) too, but it never occurred to me to use it monadically for this purpose. Wood, trees... you know how it is sometimes. -- For information abou

[Jprogramming] Promoting a vector to a matrix (changing rank)

2012-12-11 Thread Alex Giannakopoulos
Is there a better way (rhetorical question) to promote an n-element vector, i.e. of of shape N to a single row matrix of shape (1 N) ? The best I have come up with so far is: v2m =. ] $~ 1,$ I have read up on m"n in the Dictionary, but can't make much sense of it. --

Re: [Jprogramming] @: and capped fork

2012-12-03 Thread Alex Giannakopoulos
ould be: > > do_something 'bee' > do_something 'see' > > Another variation would be: > > b_a_=: 'bee' > s_a_=: 'see' > do_something@do_a_&> nl_a_ 0 > > But obviously one of my questions would be: why do we even have an >

Re: [Jprogramming] @: and capped fork

2012-12-03 Thread Alex Giannakopoulos
Thanks Stefano, that's what I meant, viz. how can you access a structure within a variable, whether its a box or whatever, by a variable that is only defined within the context of the main variable, i.e. not an index, but a structure name. Same as you'd do with a "struct" in C. A property, or what

Re: [Jprogramming] @: and capped fork

2012-12-03 Thread Alex Giannakopoulos
On 3 December 2012 15:59, Raul Miller wrote: > That said, when I want to translate J into a language other people > understand, Javascript is usually my first choice. > Why does that not surprise me? :-) Incidentally, and if you have nothing better to do, how would you code this Javascript in

Re: [Jprogramming] @: and capped fork

2012-12-03 Thread Alex Giannakopoulos
On 3 December 2012 15:59, Raul Miller wrote: > Also, there isn't anything you can do with lambda notation that you > cannot do in J. J's gerunds have all the expressiveness of lambdas, > and you can implement anything in them up to and including call/cc. > Raul, you know your stuff and I always

Re: [Jprogramming] @: and capped fork

2012-12-03 Thread Alex Giannakopoulos
> *Ric Sherlock* tikkanz at gmail.com > *Sun Dec 2 20:58:35 UTC 2012 > > *The issue becomes - are we writing scripts/libraries to showcase J to beginners > or to provide performant utilities for users? IMO, = if you want to push J =, there is only one answer to that question. The old hands will w

Re: [Jprogramming] @: and capped fork

2012-12-03 Thread Alex Giannakopoulos
*> Don Guinn* donguinn at gmail.com *> Sun Dec 2 14:12:01 UTC 2012 > >* [BASIC] and the popular programming languages today are all essentially scalar. > They handle one element at a time and use loops to handle arrays. While the central point of what you are saying is definitely true, remember t

Re: [Jprogramming] @: and capped fork

2012-12-01 Thread Alex Giannakopoulos
Would be amazing, and really useful for educational purposes too, if we could change between modes on the fly. On 2 December 2012 06:00, Alex Giannakopoulos wrote: > Thanks Ric, > > I'd been looking all over the config files, but somehow I missed it. > The Tree view is great t

Re: [Jprogramming] @: and capped fork

2012-12-01 Thread Alex Giannakopoulos
Thanks Ric, I'd been looking all over the config files, but somehow I missed it. The Tree view is great too (was it really there in 602??) A fantastic feature, this too should have pride of place in any J intro blurb. Man, 701 seriously undersells itself! On 1 December 2012 12:24, Ric Sherlock

Re: [Jprogramming] @: and capped fork

2012-12-01 Thread Alex Giannakopoulos
I am not sure Ian really meant BASIC when he said "people who know BASIC". Perhaps the gist of what he meant was "people who want to do basic programming". No-one really uses old-style BASIC today, regardless of what marketing blurbs may say. I have *never* seen anyone recommend it to people who

Re: [Jprogramming] @: and capped fork

2012-12-01 Thread Alex Giannakopoulos
Thanks Ric I wasn't thinking of myself so much, I've got used to the J convention now, but more of what would make a good default startup for a newcomer. I will look at the script though, always nice to see how others do it. As for the capped fork, yes I can live without it, just about, but I ce

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Alex Giannakopoulos
Hm, yes, I hadn't realised both cases could be specified implicitly, that's really useful. Another one for the FAQ! On 1 December 2012 04:37, Alex Giannakopoulos wrote: > Great, thanks, hadn't seen that technique before! > > > On 1 December 2012 04:35, km wrote: >

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Alex Giannakopoulos
ition of isint specifies [: as the dyadic case, and [; rejects > every argument with a domain error. > > Kip Murray > > Sent from my iPad > > > On Nov 30, 2012, at 10:14 PM, Alex Giannakopoulos > wrote: > > > On 30 November 2012 16:17, Bo Jacoby wrote: > &g

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Alex Giannakopoulos
Incidentally, does Jsoftware have an individual responsible for presentation, marketing, outreach, holy-rolling etc? If, say, I wanted to contribute something, who would coordinate? Or does it all just get (somehow) vetted through the community here? --

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Alex Giannakopoulos
On 30 November 2012 16:17, Bo Jacoby wrote: > J is a rich language, and it might be a good idea to define an elementary > subset for beginners. Couldn't agree more. A simple startup configuration file. Define verbs for trig functions so they don't look stupidly arbitrary. Some other elementary

Re: [Jprogramming] @: and capped fork

2012-11-29 Thread Alex Giannakopoulos
I agree that all this needs more and *clear* and *visible* explanation! It was the first question I asked, and in the two+ years (on-and-off) that I have been mucking around with J I have seen asked on this forum umpteen times. I have also seen it debated at length (and breadth and depth). By expe

Re: [Jprogramming] Splitting (re-arranging) a matrix

2012-11-21 Thread Alex Giannakopoulos
Really need to watch my typing. Correction: Which is all my reshape2s verb does, i.e. reshape a 2M x N into an M x 2 X N -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Splitting (re-arranging) a matrix

2012-11-21 Thread Alex Giannakopoulos
: _2 ]\ ]) i. 6 3 > > Note that this is almost identical to Roger Hui's suggestion. > > -- > Raul > > On Wed, Nov 21, 2012 at 1:12 PM, Alex Giannakopoulos > wrote: > > Well, I'm having a bit of trouble getting my head around "key", I'll keep >

Re: [Jprogramming] A little UBUNTU help

2012-11-21 Thread Alex Giannakopoulos
Yeah, that's a brilliant idea. Looking at doing the same. I know Oracle's VM runs well, I've tried Solaris on it. I've got *OLD* windows software that I need to use on occasion, which won't run on modern systems. On 21 November 2012 18:32, Don Guinn wrote: > Thanks for all the help. Actually in

Re: [Jprogramming] A little UBUNTU help

2012-11-21 Thread Alex Giannakopoulos
Don't see why not, though you can already install Linux on Netbooks, so I'm not sure what you'd be gaining. However, since Chromebook in its original form, is meant to be some kind of Web-based, always-connected thingy (don't you love this ever-progressive dumbing down of consumer computing?) you

Re: [Jprogramming] Splitting (re-arranging) a matrix

2012-11-21 Thread Alex Giannakopoulos
Well, I'm having a bit of trouble getting my head around "key", I'll keep at it though... However I was inspired by Raul's solution to come up with something that worked and I understood. Well, sort of understood anyway, why does the evenoddrows verb not need to be (0 2 |: @ reshape2s) ? reshap

Re: [Jprogramming] A little UBUNTU help

2012-11-21 Thread Alex Giannakopoulos
I've got the same on another system. Ubuntu Server installation, Xubuntu desktop. Works dandy. Kubuntu is nice too, if somewhat heavyweight. Frankly there was nothing wrong with Gnome before, IMHO, but I can't figure where they're going with Gnome 3. I wonder if it has to do with mobiles, Unity

  1   2   >