Talk:PrimitivePrimitives
This page is for general comments, ideas, enhancement requests, bugs, etc. related to PrimitivePrimitives. Use the entry below as a format example with a @SIG@ at the end.
Monad i.
The shorter monads i. doesn't work:
($ +/\@:(#&1)@:(*/)) 3 1 2 3 ($ (,~ <:@:{.)^:]@:(*/)) ,.3 0 1 2 3 0 1 2 3 0 1 2 3 ($ +/\@:(#&1)@:(*/)) 1 1 1$3 1 1 1 1 1 1 1 1 1
If it's not Full, the specific domain needs to be indicated.
-- Oleg Kobchenko <<DateTime(2007-03-22T18:04:43Z)>>
Good point, {.i.b.0 is 1. So ($ (,~ <:@:{.)^:]@:(*/))"1 should work. For the 1+ problem of the first solution, just subtract one: ($ _1 + +/\@:(#&1)@:(*/))"1 or ($ +/\@:(0 0:} #&1)@:(*/))"1.
Then there's the problem with negative dimensions giving reversed axes. I havne't checked yet; does your soln handle that? There are plenty of ways to approach this; the first that comes to my mind is ;.0. So, another stab, neccesarily longer:
i =: ((0 ,: _ * *) ];.0 ($ _1: + +/\@:(#&1)@:(*/))@:|)"1 *./ (i -: i.)&> (,. 3);0;(2 2 $ 4 5 6 7);(4 _5 6);(0 _1 0) 1
This raises a bigger and more important issue: we need comprehensive test cases for each primitive. I believe several I've sumbitted are wrong in certain edge cases. But thinking of all the edge cases is difficult.
Perhaps I'll make an addon that provides a framework for this page; users can try to re-create primitives , the addon will then test their correctness, and submit them if good.
I'm also convinced this page now needs a new layout, because it's hard to fidn the correct entry in the table, and harder still to edit it. Maybe something akin to the Vocabulary's layout?
-- Dan Bron <<DateTime(2007-03-22T18:28:34Z)>>
A more correct full form is ($ _1+[:+/\1#~*/)"1
Yep, got that earlier, thanks. Please observe Wiki etiquette and don't edit the page when informed that I have it locked.
-- Dan Bron <<DateTime(2007-03-22T18:28:34Z)>>
Hey, we can use I. instead of _1 + +/\ . And we can elide from 0 ,: _ * * the 0 ,:. So now we have:
i1 =. ((_ * *) ];.0 ($ [: I. 1 #~ */)@:|)"1 *./ (i1 -: i.)&> (,. 3);0;(2 2 $ 4 5 6 7);(4 _5 6);(0 _1 0) 1
Note that 1-:{.I.b.0, so if we're clever enough, we might be able to lose the explicit "1 and a pair of parens...
Oh, and though I don't think we can exploit it to create a shorter solution, note: 1 2 3 4 5 -: (1&#.)\ 5 # 1
-- Dan Bron <<DateTime(2007-03-22T18:58:00Z)>>
New Layout
A possible layout is making a primitive-named separately-valenced page under this one for each primitive; moving the last comment column there; place all other comments, primitive-specific discussion and test cases there; use row-first dictionary order here. Otherwise the table is fine, albeit editing will need some skill. Sorry about the etiquette.
-- Oleg Kobchenko <<DateTime(2007-03-22T19:02:01Z)>>
I've started working on a new layout. Please see User:Dan Bron/Temp/PrimitivePrimitives. I've made one example vocab page, at i: .
The problem is I'm having touble transcluding the monadic and the dyadic definition subpages into the primary i: subpage. I followed the example at FrontPage, but to no avail. The transcluded pages dont' show up in the table.
Can you help? And if you have formatting or layout suggestions, I'm all ears. Deel free to make any changes you like.
-- Dan Bron <<DateTime(2007-03-22T21:54:52Z)>>
Because space is contrained, it makes sense to use one row per primitive entry. This means that different valances as well as different variants are one per row, because make sense to list principally different interesting variants on the main page.
It's good to use normative primitive names from the dictionary for the sub-pages and their references on the main page. Because dyads and monads are named differently, there is no need to state the "Monad"/"Dyad" classifier. For operators, use font style as in Dictionary.
Here's an example,
Name Replacement Domain i. /Integers ([:> +/&.>/)@((* _1++/\@#&1)&.>~ 1,~[:*/\.}.) 0<$y, 0<y ($ +/\@:(#&1)@:(*/)) Full ($ (,~ <:@:{.)^:]@:(*/)) Full /Index Of [: +/ [: *./\ ~: 0=#$x, 1=#$y I. /Indices # i.@:# Full
The "/" artifact is used for compactness. Also note short domains. All comments are at separate pages. Note empty first column header.
The contents of the separate pages is like discussion we had above about monad i.
-- Oleg Kobchenko <<DateTime(2007-03-23T01:21:05Z)>>