where
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
1 post
• Page 1 of 1
where
In previous posts, the game was to write functions g such that
for x and y of interest where g does not use the primitive symbol in question. Here, the game is to write a function h which does not use ⍸ or / or ⌿, so that for boolean vector b,
Since ⎕io is intimately involved with ⍸, the expression should work when ⎕io is 0 or 1. (Nevertheless, ⎕io delenda est!.)
Without 0
The non-zero elements of b×⍳≢b nearly have what is required. We do need put back a leading 0 when ⎕io is 0 and the leading element of b is 1.
Without Without
If we are paranoid and suspect that / (replicate) may be involved in computing ~0, an alternative computation is to drop the requisite number of leading elements from the sorted result of ⍵×≢⍵.
(x symbol y) ≡ x g y
for x and y of interest where g does not use the primitive symbol in question. Here, the game is to write a function h which does not use ⍸ or / or ⌿, so that for boolean vector b,
b ← 1=?9973⍴2
(⍸b) ≡ h b
1
Since ⎕io is intimately involved with ⍸, the expression should work when ⎕io is 0 or 1. (Nevertheless, ⎕io delenda est!.)
Without 0
ww ← {(⍳⎕io<⊃⍵),0~⍨⍵×⍳≢⍵}
(⍸b) ≡ ww b
1
The non-zero elements of b×⍳≢b nearly have what is required. We do need put back a leading 0 when ⎕io is 0 and the leading element of b is 1.
Without Without
ws ← {(+/~⍵) ↓ {⍵[⍋⍵]} ⍵×⍳≢⍵}
(⍸b) ≡ ws b
1
If we are paranoid and suspect that / (replicate) may be involved in computing ~0, an alternative computation is to drop the requisite number of leading elements from the sorted result of ⍵×≢⍵.
- Roger|Dyalog
- Posts: 238
- Joined: Thu Jul 28, 2011 10:53 am
1 post
• Page 1 of 1
Who is online
Users browsing this forum: ray and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group