Re: [Jprogramming] delete item; ass. lists

2017-12-05 Thread Andrew Dabrowski
That's nice, thanks.  Comments/questions below. On 12/04/2017 02:42 PM, Raul Miller wrote: If you're really going to use this one item at a time, you can greatly increase average performance of deletes by deferring them for later (for example). Similarly, you can avoid some overhead by implemen

Re: [Jprogramming] delete item; ass. lists

2017-12-04 Thread Andrew Dabrowski
Here's my solution.  Not doubt it is ugly and slow.  I look forward to you guys showing me how to do it correctly. emptyHash =: ,~ ,. < 'not found' hashSet =: dyad define 'key val' =. y pos =. x hashGetInd key if. pos = 1{ $x do.  x ,"(1,0) key ; val else.  ((< key) pos} (0{x)) ,: (< val) pos}

Re: [Jprogramming] delete item; ass. lists

2017-12-03 Thread Andrew Dabrowski
I see a space after the 'inv' keyword. Well.. it could still be bitrot, but perhaps at the cloudfront level rather than on the site itself... Thanks, -- Raul On Sun, Dec 3, 2017 at 1:24 PM, Andrew Dabrowski wrote: 1. Yes, I should been more specific: I wanted to know the idioma

Re: [Jprogramming] delete item; ass. lists

2017-12-03 Thread Andrew Dabrowski
1. Yes, I should been more specific: I wanted to know the idiomatic way to delete the nth item of a list, so I think <<< is what I was looking for. What is <<< called and where is it documented? 2. Not sure what you mean by "Their focus is on micromanaging the sequence of operations."  A-lists

[Jprogramming] delete item; ass. lists

2017-12-03 Thread Andrew Dabrowski
1. What's the idiomatic way to delete an item from a list?  This doesn't seem to come up in Learning J.  For that matter, what's a good reference for list slicing ops in J? 2. Is anyone bothered by the lack of a built-in associative list structure?  There are at least two different implementat

Re: [Jprogramming] APL Exercises

2017-12-02 Thread Andrew Dabrowski
On 12/02/2017 02:17 AM, Roger Hui wrote: SC =: 3 : '(3 3$4>i.5) ,./^:2@(*/)^:y ,.1' SC confuses me. I would have thought that (3 3$4>i.5) (*/)^:y ,.1 The left operand of the power operator ^: is ,./^:2@(*/) . Oh, I parsed it as (3 3$4>i.5) (,./^:2) @ ((*/)^:y) ,.1 but it should be (3 3$

Re: [Jprogramming] J strengths?

2017-11-28 Thread Andrew Dabrowski
at the higher level.  You have to train yourself to do that, though, and doing so is harder than you would expect. Henry Rich On 11/28/2017 3:59 PM, Andrew Dabrowski wrote: As much as I've complained about J in these forums I've been having a good time translating some simple code in

[Jprogramming] J strengths?

2017-11-28 Thread Andrew Dabrowski
As much as I've complained about J in these forums I've been having a good time translating some simple code into J.  Someone gave me wise advice, to stick with explicit definitions until I know the language well, which advice I have cordially ignored because I'm having too much fun playing cod

Re: [Jprogramming] Nullary function?

2017-11-28 Thread Andrew Dabrowski
Thanks!  I think I'd seen that in Learning J but had forgotten about it. On 11/28/2017 08:27 AM, Brian Schott wrote: Yes, David Lambert's answer is good. In addition, instead of the RHA of '', using subsets of 0 1 2 3 gives nouns, adverbs,conjunctions, and verbs only. On Tue, Nov 28, 2017 at 8

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
I was reading Stokes' Learning J, but bind is not in the index. Was it a recent addition to J? Incidentally, bind =: 2 : x@(y"_), so that solution is just a variant of mine.  Someone else seems to have perceived the same lack that I did. On 11/27/2017 01:54 PM, Raul Miller wrote: I think

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
On 11/27/2017 01:00 PM, Daniel Lyons wrote: I’m sure after we master J, having to program without rank is going to make all other programming languages seem like much bigger kludges. Perhaps, but rank seems to be one aspect of J that other languages have avoided.  APL/J have been very influenti

Re: [Jprogramming] Subset Permutations

2017-11-27 Thread Andrew Dabrowski
This is the correct solution to a different problem.  Isn't k sper n supposed to return lists without repetitions? On 11/27/2017 11:36 AM, Raul Miller wrote: http://code.jsoftware.com/wiki/Essays/Odometer sper=: ] #.^:_1 i.@^~ Thanks, --

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
mming in J would be a snap, as has happened to me to some extent with Perl.  But Perl I was forced to use, J I have the option of placing in the Museum of Brilliant but Useless Languages, next to Haskell. On 11/27/2017 12:30 PM, Daniel Lyons wrote: On Nov 27, 2017, at 10:03 AM, Andrew Dabro

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
I used randel =: (? @: #) { ] Your definition rand =: randel bind l does indeed work.  I didn't know there was another bind op besides &, which I now note is actually "bond". How can I learn more about functions like bind that aren't on NuVoc? On 11/27/2017 12:09 PM, Raul Miller wrote: I

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
On 11/26/2017 01:27 PM, Raul Miller wrote: You don't really mean that. ;) I do. A function is a relationship between argument and result where there's each argument has exactly one result. That's the mathematical definition.  I'm talking about programming. So a function of no arguments would

[Jprogramming] Nullary function?

2017-11-26 Thread Andrew Dabrowski
Is it possible to define a nullary function in J?  In other languages they're sometimes convenient, for example a function that returns a random element.  It's a bit awkward to have to use a dummy argument, like randdie =: 1 + ? @: 6: which must be called like randdie 0 and when used in a ta

Re: [Jprogramming] initial reaction to J

2017-11-19 Thread Andrew Dabrowski
Thank /you/ for /your/ comments. I'll look through the repos, thanks for the link. Could one say J's intention is the following? Be a great array processing language, and since utility functions for arrays are naturally binary or ternary at worst therefore the built-in verbs provide a great b