I did an emulation, some 15 or 20 years ago, in visual basic 5 -based on
an ancient but still working, HP11C which a predecessor of the 50g. It
definitely can be done in J (I had to set up my own complex number
subroutines). New values were added at the bottom of the stack as with
HP calculato
e.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord
Sent: Saturday, September 13, 2014 6:47 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] rpn calculator
This is a nice calculator! It brings back some early memories. Linda
-Original Message-
From: programmin
: Re: [Jprogramming] rpn calculator
Thanks very much, Dan, and thanks for the advice on verb swap. I renamed
clear to clstk.
--Kip
On Friday, September 12, 2014, Dan Bron wrote:
> Kip,
>
> The adverb is what you think it is, except you need to use a little trick
> to wor
Here's a few examples that relate to how I think of A. ...
(i.6) A. i.3
0 1 2
0 2 1
1 0 2
1 2 0
2 0 1
2 1 0
The number of permutations is the factorial of the number of items
being permuted.
(0,~.!i.6) A. i.6
0 1 2 3 4 5
0 1 2 3 5 4
0 1 2 4 3 5
0 1 3 2 4 5
0 2 1 3 4 5
1 0 2 3 4 5
Permutat
Brian Schott wrote:
> 1 A. b transposes the last two items of b
A. is really cool. The problem with using it is coming up with the correct
left-hand argument (code) for the permutation you want. A few special ones
are easy to remember (particularly 0 for "do nothing", _1 for "reverse",
and 1 for
>minus =: - op2Arg
>times =: * op2Arg
>divide =: % op2Arg
>
>clear'' NB. Initialize global vector STACK
> 5 2 enter''
> 5
> 2
>1 dup''
> 5
>
Dan,
Your swapping note is an eye opener for me. (I also appreciated your answer
regarding the RPN calculator.
The following link suggests one particular swap using A. that might be
handy, also. "1 A. b transposes the last two items of b,"
http://jsoftware.com/help/dictionary/dacapdot.htm
On F
Kip wrote:
> NB. swap?
Oh, I meant to mention, the most fun way to swap things in J is using C. :
(<0 1) C. 'AbCdEfGhI'
bACdEfGhI
(<4 5) C. 'AbCdEfGhI'
AbCdfEGhI
-Dan
--
For information
5
2
2
times''
5
4
plus''
9
sqrt''
3
- Original Message ---
Subject: [Jprogramming] rpn calculator
From: Kip Murray
Date: Fri, 12 Sep 2014 08:17:42
I'm proud of the Reverse Polish Notation calculator shown below (think HP
50g in rpn mode). My question is, can you devise an adverb monad so that
sqrt =: %: monad
produces the sqrt verb below?
Examples
clear'' NB. Initialize global vector STACK
5 2 enter''
5
2
1 dup''
5
2
2
tim
Put it this way- what you have is eons ahead of what I have (Appears to
be a challenge to texas intruments with more bells and whistles). Yes,
my old (30-40 yrs?) Hp11C is pretty limited in comparison- but it still
serves me well and as with yours- has entry of one number at a time.
Having an u
I was emulating an HP 50g in rpn mode, which has an unlimited stack.
However, entering more than one number at a time is not possible on the HP
50g !
On Thursday, June 5, 2014, Don Kelly wrote:
> it may depend on what you are trying to do.
> Are you trying (as it appears) to put in more than o
> 5
> 6
> 7
>reciprocal''
>0
>1
>2
>3
> 4
>5
>6
> 0.142857
>divide''
> 0
> 1
> 2
> 3
> 4
> 5
> 42
>square =: times@dup NB. or *: Monad
>
it may depend on what you are trying to do.
Are you trying (as it appears) to put in more than one stack element at
a time as in 1 2 enter puts 1 in "y" 1 in the "x "register?
I can see some advantage to this.
If you are trying to emulate something like an HP 11C (which I have in
front of me)
3
4
5
6
0.142857
divide''
0
1
2
3
4
5
42
square =: times@dup NB. or *: Monad
square''
0
1
2
3
4
5
1764
Date: Thu, 5 Jun 2014 00:45:40 -0500
From: Kip Murray
To:"programm...@jsoftware.com"
Subject: [Jprogrammi
;
> Linda
>
>
>
> -Original Message-
> From: programming-boun...@forums.jsoftware.com
> [mailto:programming-boun...@forums.jsoftware.com ] On
> Behalf Of Kip Murray
> Sent: Thursday, June 05, 2014 1:46 AM
> To: programm...@jsoftware.com
> Subject: [Jpr
inus plus 2 dup chs 1 2 enter clear ''
0
Linda
-Original Message-
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Kip Murray
Sent: Thursday, June 05, 2014 1:46 AM
To: programm...@jsoftware.com
Sub
The following emulates a simple reverse Polish notation calculator which
operates on numbers at the bottom of a stack, replacing them by the result.
How would you do it? (Beware of line wrap.)
clear =: 3 : ',.STACK =: '
enter =: 4 : ',.STACK =: STACK , x' NB. x a list of numbers
ch
18 matches
Mail list logo