> From: Kip Murray
>
> Andrew, Oleg's dyadic verb faces below works correctly on my example
> 4 3 0 ,: _4 _3 _2 -- try
>
> <"_1 [ 4 3 0 faces _4 _3 _2
>
> -- and Oleg claims his faces works in all dimensions, see his examples below.
>
I Olegs verb returns (n-1) dimensional faces of n-dimensional boxes.
I meant k dimensional faces of n-dimensional boxes.
For regular cube 2-face is what normally called "face", 1-face is an edge and
0-face is a vertex.
require 'statfns'
kfaces=:4 : 0"0 2
n=.{:$y
k=.x
id=.(i.n) (e."1) (n-k) comb n
,/(({.y) +"1 ({:y) *"1 (#^:_1"1 #:@i.@(2 ^ +/))"1 id) ,:"1 ({:y) *"1 -.id
)
C=.4 3 0 ,: _4 _3 _2
<"2 ] 0 kfaces C
┌─────┬──────┬─────┬──────┬─────┬──────┬─────┬──────┐
│4 3 0│4 3 _2│4 0 0│4 0 _2│0 3 0│0 3 _2│0 0 0│0 0 _2│
│0 0 0│0 0 0│0 0 0│0 0 0│0 0 0│0 0 0│0 0 0│0 0 0│
└─────┴──────┴─────┴──────┴─────┴──────┴─────┴──────┘
<"2 ] 1 kfaces C
┌──────┬──────┬──────┬──────┬──────┬───────┬──────┬───────┬──────┬───────┬──────┬───────┐
│4 3 0│4 0 0│0 3 0│0 0 0│4 3 0│4 3 _2│0 3 0│0 3 _2│ 4 3 0│ 4 3 _2│ 4 0
0│ 4 0 _2│
│0 0 _2│0 0 _2│0 0 _2│0 0 _2│0 _3 0│0 _3 0│0 _3 0│0 _3 0│_4 0 0│_4 0 0│_4 0
0│_4 0 0│
└──────┴──────┴──────┴──────┴──────┴───────┴──────┴───────┴──────┴───────┴──────┴───────┘
<"2 ] 2 kfaces C
┌───────┬───────┬───────┬───────┬───────┬────────┐
│4 3 0│0 3 0│ 4 3 0│ 4 0 0│ 4 3 0│ 4 3 _2│
│0 _3 _2│0 _3 _2│_4 0 _2│_4 0 _2│_4 _3 0│_4 _3 0│
└───────┴───────┴───────┴───────┴───────┴────────┘
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm