Hello:
I programmed APL in college.
Is there a free version out there?
I have J on my desktop, but can't get my head around no line numbers,
and gotos.
Yours, Bob.
Quoting Raul Miller <rauldmil...@gmail.com>:
On Thu, Apr 3, 2014 at 6:19 PM, Omar Antolín Camarena <
omar.anto...@gmail.com> wrote:
fn =: 1 : '(2 2 1 1 4 3 3 {~ 1 i.~ (_1 <\ ''vnumxy'') e. ;: m) : m'
That's clever thinking.
1. In APL's with this {} syntax, can you force a function whose source code
only mentions omega to be dyadic? I.e., in J I can do 3 : 'y*y', but also 4
: 'y*y'.
Here's how you can do that the fn way:
'y * y return. x' fn
2. Beyond these what are the advantages and disadvantages of J's and APL's
{} way of dealing with explicit definition?
J's way lets you define both monadic and dyadic definitions together.
And, on a related note, the way you have defined fn, adverbs (and
conjunction) can only produce monadic verbs. You do not support things like
this:
combiner=:1 :0
:
x,m,y
)
3. Why does J require you to specify the left argument to :? Is it for the
reason in question 1?
J allows two different kinds of left arguments for :
A numeric left argument controls the type of explicit definition being
generated.
But you can also combine two verbs. Consider, for example:
('-y' fn) : ('x-y' fn)
That's a long-winded way of expressing subtraction, but the point is that
both monadic and dyadic definitions are supported.
10 '-y' fn : ('x-y' fn) 3
7
'-y' fn : ('x-y' fn) 3
_3
4. Is there a better name for this adverb than fn?
We could call it George, if you like?
5. What would be a more robust rule for picking the type of the resulting
operator? I mean, presumably 'u * x i. u=. ~. y' (ignore the random
nonsense) is meant to be a dyadic verb even though it contains a u. I guess
one could only count references to u if u never occurs as the target of a
copula or something like that. (I don't think this problem arises in APL,
because I don't think assignments to alphalpha are allowed, but I might be
wrong.)
Hopefully my answers to your question 1 and 2 shed some light on this issue.
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm