I was sending calcic2.ijs to you as a pm, Ric, but then thought the
forum ought to be brought in.

But having uploaded it to the JinaDay page, like you were doing, I
simply forgot to detach the attachment.

Looks like Bill has put his finger on it. I guessed it had something
to do with deferred definition. It worried me that typing this into
IJX...
   plus=: + in
executed 'in' at assignment time, not when 'plus' was run by the handler.
(Maybe this part of the discussion should be moved to Programming forum?)

Umm... I don't think this is an area I want to get into, except as
part of a masterclass. Something for JtheMorningAfter. Certainly not
in a peace-offering to unregenerate APLers, who won't need much
convincing that J is touchy where adverbs are concerned. NOt the
message I want to send.

How to finesse this in JinaDay? Ought I to say? ...

"Don't push the gui too hard, to make it read your mind."
(...viz. that 'in' is going to be defined later as an adverb, not a verb)

"With enough explicitly-defined cover functions you can get round most
problems, 'cos those bind at execution time."

"Only assign safe monadic verbs to handlers, until you know what you're doing"
(...like I dont, lol)

Or ought I to shut the door on the whole topic -- and not provoke
novices with code teetering on the brink of complex issues?

I do so want to give a natural-looking example where a user-defined
adverb would really be useful, and invoke it tacitly, to show APLers
there's nothing to be afraid of.

Ian


On Wed, Nov 3, 2010 at 8:51 AM, Sherlock, Ric <[email protected]> wrote:
> Ian,
>
> I was surprised when I saw your attachment in the forum, I had thought that 
> the forum didn't accept them. Doesn't look like it accepted mine. I will send 
> it to you directly.
> Ric
>
>> -----Original Message-----
>> From: [email protected] [mailto:general-
>> [email protected]] On Behalf Of Sherlock, Ric
>> Sent: Wednesday, 3 November 2010 21:30
>> To: General forum
>> Subject: Re: [Jgeneral] "J In A Day" --crits please
>>
>> I think Bill is right,
>> Options are to make sure adverb definition is before tacit handler
>> definition or make the handler definition explicit. The attached shows
>> both approaches.
>>
>> Also:
>> Seems that acc should be ACC to be consistent with NEWNUMBER .
>> Moved initialization of ACC and op to clr .
>> Seems pointless to bind numeric digits to digit and convert them to
>> character.
>> 8!:2 automatically converts _ to - .
>>
>>
>>
>> > From: Ian Clark
>> > Sent: Wednesday, 3 November 2010 15:59
>> >
>> > Hi Ric,
>> >
>> > Thanks for helping to extend calc.ijs.
>> > I've been developing in parallel with yours, but have raided some of
>> > your verbs, which are neater than mine. The result is uploaded same
>> > place as yours (attachments: JinaDay) as: calcic2.ijs
>> >
>> > It has a full range of + - * / buttons, implemented with (verb):
>> > setop, which I feel is a little clunky. Out of interest I've tried a
>> > neater alternative, an adverb called: in, so I can use +in, -in, etc.
>> > It would be a nice demo of adverbs returning verbs. But I think I've
>> > hit a J bug...
>> >
>> > This works fine:
>> > calc_times_button=: doit
>> >
>> > ...where doit is defined, as in the script, _after_ the definition
>> of:
>> > in as:
>> > doit =: *in
>> >
>> > But this doesn't (it upsets the gui somehow):
>> > calc_times_button=: * in
>> >
>> > Nor does this:
>> > doit =: *in
>> > calc_times_button=: doit
>> >
>> > Can you see what I'm doing wrong? I can't.
>> >
>> > Ian
>> >
>> >
>> > On Wed, Nov 3, 2010 at 1:10 AM, Sherlock, Ric
>> > <[email protected]> wrote:
>> > > Further update to calc2.ijs:
>> > >
>> > > Altered button order/layout.
>> > >
>> > > Moved NEWNUMBER=: 1 to update rather than repeating in each
>> operation
>> > button.
>> > >
>> > > Ends up highlighting another gotcha for new users:
>> > > If you define a verb whose result is a verb, adverb or conjunction
>> > then J will report a syntax error when the verb runs. If no result is
>> > required then a common solution is to add an extra line that returns
>> > "empty" (i.0 0)
>> > >
>> > >> From: Sherlock, Ric
>> > >> Sent: Wednesday, 3 November 2010 12:55
>> > >>
>> > >> Yes, when I got around to testing in a clean session I had noticed
>> > that
>> > >> too.
>> > >> The latest version on the wiki initializes them.
>> > >>
>> > >> > From: Ian Clark
>> > >> > Sent: Wednesday, 3 November 2010 12:52
>> > >> >
>> > >> > I get value errors for op and acc on starting up, unless I
>> > initialise
>> > >> > them in calc_run.
>> > >> >
>> > >> > On Tue, Nov 2, 2010 at 9:55 PM, Sherlock, Ric
>> > >> > <[email protected]> wrote:
>> > >> > > I've made some more "improvements" to calc2.ijs. Includes "-"
>> > >> button.
>> > >> > > Adding additional operations should be trival.
>> > >> > > Renamed the verb "clear" to "clr" so that clear_z_ is still
>> > easily
>> > >> > useable.
>> > >> > >
>> > >> > > I use the TortoiseMerge app to do diffs between similar
>> versions
>> > of
>> > >> a
>> > >> > script. I'm sure you have your own favourite.
>> > >> > >
>> > >> > > Ric
>> > >> > >
>> > >> > >> From: Of Ian Clark
>> > >> > >> Sent: Tuesday, 2 November 2010 17:12
>> > >> > >>
>> > >> > >> Thanks for calc2, Ric.
>> > >> > >>
>> > >> > >> I'll have to study it closely because it's much like my own
>> > >> > extension,
>> > >> > >> but not exactly so.
>> > >> > >>
>> > >> > >> I also feel that buttons for the remaining ops are needed
>> now,
>> > and
>> > >> > >> that this needn't complicate the demo too much. In fact with
>> > the
>> > >> use
>> > >> > >> of 'bind' (and I was confusing 'bind' and Bond but you didn't
>> > say
>> > >> > >> anything) my demo has become if anything too simple to
>> > illustrate
>> > >> > what
>> > >> > >> I originally wanted to.
>> > >> > >>
>> > >> > >> Ian
>> > >> > >>
>> > >> > >>
>> > >> > >> On Tue, Nov 2, 2010 at 2:15 AM, Sherlock, Ric
>> > >> > >> <[email protected]> wrote:
>> > >> > >> >> From: Ian Clark
>> > >> > >> >> Sent: Tuesday, 2 November 2010 09:33
>> > >> > >> >>
>> > >> > >> >> > I agreed with Brian that I missed the "equals" button in
>> > the
>> > >> > >> original
>> > >> > >> >> calc.ijs. Now I miss the "plus" button. It seems
>> unintuitive
>> > to
>> > >> > >> press
>> > >> > >> >> "=" when you want to add.
>> > >> > >> >>
>> > >> > >> >> Hahaha! (Can't please everybody.) Can I interest you in a
>> > more
>> > >> > >> >> advanced calculator? It's called J ... :-)
>> > >> > >> >>
>> > >> > >> >> I'm just glad I wasn't on the design team of the original
>> > >> pocket
>> > >> > >> >> calculator. It's subtler than it looks.
>> > >> > >> >>
>> > >> > >> >> Providing both '+' and '=' buttons means adding a whole
>> row
>> > or
>> > >> > >> column
>> > >> > >> >> of buttons or it looks untidy. I've a calc with the
>> > >> conventional
>> > >> > >> >> look'n'feel -- but IMO it's too complex to serve as a good
>> > >> demo.
>> > >> > >> >>
>> > >> > >> >
>> > >> > >> > I've attached an alternative layout to the JinaDay wiki
>> page
>> > >> > (named
>> > >> > >> calc2.ijs) that includes separate '=' and '+' buttons. There
>> > are
>> > >> > also
>> > >> > >> some minor changes to some of the verbs to make it work more
>> > like
>> > >> my
>> > >> > >> calculator and make it easier for users to add other
>> operation
>> > >> > buttons.
>> > >> > >> See if you think that works/looks OK.
>> > >> > >> >
>> > >> > >> >> > The current phrasing of your "blasphemous comment" has
>> > more
>> > >> > impact
>> > >> > >> >> but I get the feeling that your actual message is more
>> like:
>> > >> > "There
>> > >> > >> is
>> > >> > >> >> no need to get your head around tacit definition".  The
>> fact
>> > is
>> > >> > that
>> > >> > >> >> many of the button handlers in the calc script use tacit
>> > code!
>> > >> I
>> > >> > >> >> suppose it comes down to whether you think that being
>> > >> provocative
>> > >> > >> >> rather than reassuring will help get your message across
>> > best.
>> > >> > >> >>
>> > >> > >> >> "Here Be Dragons..."
>> > >> > >> >>
>> > >> > >> >> I meant to be reassuring by being provocative. Reassuring
>> > (to
>> > >> > >> APLers)
>> > >> > >> >> by being (or, rather, risking being) provocative to J-ers.
>> > >> > >> >>
>> > >> > >> >> De-mystifying a topic is never free from the insinuation
>> > that
>> > >> the
>> > >> > >> >> mystery is intentional: or at the very least, serving
>> > someone's
>> > >> > >> >> purpose. People are quite smart, you know. If a mystery
>> > serves
>> > >> no
>> > >> > >> >> purpose -- or no one's purpose -- it soon gets cleared up.
>> > It
>> > >> > >> follows
>> > >> > >> >> that de-mystification is apt be viewed as de-bunking.
>> > >> > >> >>
>> > >> > >> >> It wasn't my intention to debunk. Simply to cast some
>> light.
>> > >> > Maybe
>> > >> > >> to
>> > >> > >> >> let in some fresh air.
>> > >> > >> >>
>> > >> > >> >> On first encountering APL my initial response was to feel
>> > >> > >> inadequate.
>> > >> > >> >> I should have felt humble, but instead I felt humiliated.
>> > >> Because
>> > >> > at
>> > >> > >> >> the time I was masquerading as a "computer scientist", ie
>> an
>> > >> > expert.
>> > >> > >> >> This was back in 1973, when the industry was less
>> > fragmented.
>> > >> It
>> > >> > was
>> > >> > >> >> "IBM and the Seven Dwarfs" -- and I was IBM.
>> > >> > >> >>
>> > >> > >> >> So I looked for holes. For excuses to label APL as mad,
>> not
>> > >> > >> brilliant.
>> > >> > >> >> Then I'd be exposed as sane, not stupid. It reassured me
>> to
>> > >> swap
>> > >> > sly
>> > >> > >> >> remarks about the language, especially as others felt the
>> > same
>> > >> as
>> > >> > I.
>> > >> > >> >>
>> > >> > >> >> On first encountering J, I experienced the selfsame
>> feeling
>> > I
>> > >> had
>> > >> > on
>> > >> > >> >> first meeting APL. It largely revolved around "tacit
>> > >> > programming".
>> > >> > >> >> Attempts by those who'd Seen The Light to motivate me by
>> > saying
>> > >> > >> "it's
>> > >> > >> >> really quite easy" -- or -- "it's far better than APL
>> doing
>> > it
>> > >> > this
>> > >> > >> >> way" simply provoked hostility. And not just in me, I
>> > observed.
>> > >> > >> >>
>> > >> > >> >> So there was a barrier to surmount, before I could
>> > contemplate
>> > >> J
>> > >> > >> >> equably, let alone consider using it myself for a serious
>> > task.
>> > >> > >> >>
>> > >> > >> >> Tacit programming _isn't_ "really quite easy". In
>> principle,
>> > >> > >> maybe...
>> > >> > >> >> But in practice it's as much a strain as coding in 68000
>> > ASM.
>> > >> > (Yes,
>> > >> > >> >> done that -- and sold the result).
>> > >> > >> >>
>> > >> > >> >> And that, I think, is the way to look at it. Those who can
>> > do
>> > >> it
>> > >> > can
>> > >> > >> >> justly be proud of their skill. But nobody is ashamed of
>> not
>> > >> > being
>> > >> > >> >> able to compose 68000 machine code in their heads without
>> > >> > computer
>> > >> > >> >> assistance, so why should they be when it's tacit J?
>> > >> > >> >>
>> > >> > >> >> There is this difference. Machine-code is best kept
>> beneath
>> > the
>> > >> > >> >> covers. But tacit J beneficially seeps out. As you
>> observe,
>> > >> > there's
>> > >> > >> >> tacit code in calc.ijs.
>> > >> > >> >>
>> > >> > >> >> IMO the issue over tacit J is not whether we should banish
>> > >> > (digit&1)
>> > >> > >> >> from calc.ijs, but whether we should aim to make novices
>> > >> ashamed
>> > >> > of
>> > >> > >> >> writing:
>> > >> > >> >>    quo=: 3 : 'Q,(":>y),Q'   NB. place datum in quotes
>> > >> > >> >> instead of:
>> > >> > >> >>    quo=: Q , Q ,~ [: ": >
>> > >> > >> >> because that, I think, has been counter-productive.
>> > >> > >> >>
>> > >> > >> >> They'll do so in the end... and like as not they won't
>> know
>> > >> > they're
>> > >> > >> >> doing it.
>> > >> > >> >
>> > >> > >> > I agree that it is counterproductive to denigrate the use
>> of
>> > >> > explicit
>> > >> > >> definition. I don't think that happens really, although I
>> know
>> > >> that
>> > >> > a
>> > >> > >> lot of code on the forums is tacit. As I said recently on
>> > >> > comp.lang.apl
>> > >> > >> I think this is really just a side effect of more experienced
>> > >> users
>> > >> > >> thinking and working more in tacit mode.
>> > >> > >> >
>> > >> > >> > I remember when I started learning J that I pretty much
>> > >> "ignored"
>> > >> > >> trying to create tacit verbs - I was content to stick with
>> > >> explicit.
>> > >> > I
>> > >> > >> found the tacit code on the forum hard to read/understand. I
>> > think
>> > >> > my
>> > >> > >> biggest hurdle in coming to terms with tacit was being able
>> to
>> > >> > reliably
>> > >> > >> identify the parts of speech for J's various primitives (verb
>> > vs
>> > >> > adverb
>> > >> > >> vs conjunction). Without that knowledge it is hard to
>> identify
>> > the
>> > >> > >> composed verbs and correctly separate the hooks from the
>> forks.
>> > As
>> > >> I
>> > >> > >> learnt the J primitives and their parts of speech, suddently
>> > tacit
>> > >> > >> didn't seem so hard after all, and now I find myself using it
>> > in
>> > >> > >> preference to explicit for many sentences.
>> > >> > >> >
>> > >> > >> > Having said that I'd be more inclined to promote the use
>> this
>> > >> form
>> > >> > >> than the one liner string form above. Otherwise things can
>> get
>> > >> messy
>> > >> > >> when dealing with strings.
>> > >> > >> > quo=: 3 : 0
>> > >> > >> >  Q,(":>y),Q
>> > >> > >> > )
>> > >> > >> >
>> > >> > >> > Ric
>> > >> > >> > -----------------------------------------------------------
>> --
>> > ---
>> > >> --
>> > >> > ---
>> > >> > >> -
>> > >> > >> > For information about J forums see
>> > >> > >> http://www.jsoftware.com/forums.htm
>> > >> > >> >
>> > >> > >> -------------------------------------------------------------
>> --
>> > ---
>> > >> --
>> > >> > --
>> > >> > >> For information about J forums see
>> > >> > http://www.jsoftware.com/forums.htm
>> > >> > > --------------------------------------------------------------
>> --
>> > ---
>> > >> --
>> > >> > -
>> > >> > > For information about J forums see
>> > >> > http://www.jsoftware.com/forums.htm
>> > >> > >
>> > >> > ----------------------------------------------------------------
>> --
>> > ---
>> > >> -
>> > >> > For information about J forums see
>> > >> http://www.jsoftware.com/forums.htm
>> > >> ------------------------------------------------------------------
>> --
>> > --
>> > >> For information about J forums see
>> > http://www.jsoftware.com/forums.htm
>> > > -------------------------------------------------------------------
>> --
>> > -
>> > > For information about J forums see
>> > http://www.jsoftware.com/forums.htm
>> > >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to