load 'stats'
midpt
-:@<:@#
median
-:@(+/)@((<. , >.)@midpt { /:~)
me=: 13 :'-:+/((<.,>.)-:<:#y){/:~y'
(median-:me)?10#1000
1
5!:4 <'midpt'
┌─ -:
┌─ @ ─┴─ <:
── @ ─┴─ #
5!:4 <'median'
┌─ -:
┌─ @ ─┴─ / ─── +
│ ┌─ <.
│ ┌───────┼─ ,
── @ ─┤ ┌─ @ ─┤ └─ >.
│ │ └─ midpt
└─────┼─ {
└─ ~ ─── /:
I used midpt and median to create me which I would consider reasonable
for a high school math class.
5!:4 <'me'
┌─ [:
├─ -:
│ ┌─ [:
│ ├─ / ─── +
──┤ │ ┌─ [:
│ │ │ ┌─ <.
│ │ ├────┼─ ,
└────┤ │ └─ >.
│ ┌─────┤
│ │ │ ┌─ [:
│ │ │ ├─ -:
│ │ └────┤ ┌─ [:
└─────┤ └────┼─ <:
│ └─ #
├─ {
└─ ~ ─── /:
midpt
-:@<:@#
median
-:@(+/)@((<. , >.)@midpt { /:~)
me
[: -: [: +/ ([: (<. , >.) [: -: [: <: #) { /:~
I like how (<.,>.) and can be compared to ([: <: #) Look below at (,.&.”)
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger Hui
Sent: Friday, May 09, 2014 1:05 PM
To: Programming forum
Subject: Re: [Jprogramming] Base/antibase question
: L
As I see it, it is not an analogy between the display of adverbs,
conjunctions, forks, hooks. It's a rule for displaying a function (in the
general sense) with one, two, or three arguments, and more generally
displaying a tree with an even number of branches (odd number of branches
is symmetric in an obvious way).
One argument (current display already symmetric)
── / ─── + +/
── \ ─── / ─── >. >./\
Two arguments (symmetric version)
┌─ +
──┤ +%
└─ %
┌─ ,.
── &. ─┤ ,.&.":
└─ ":
Three arguments (current display already symmetric):
┌─ / ─── +
──┼─ % +/%#
└─ #
I leave as an exercise for the reader :-) how to modify the non-symmetric
http://www.jsoftware.com/jwiki/Essays/Tree_Display and
https://groups.google.com/forum/#!topic/comp.lang.apl/Xxwd971y_lE to make
them symmetric.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm