train-spotting
1 post
• Page 1 of 1
train-spotting
It's easy and fun to code stuff like
p.s. with
quoted ← ≠\ ''''=⊢The next step naturally would be
needed ← quoted ≥ ' '⍷⊢
squeeze ← needed / ⊢but of course / is one of these damned hybrids and in this case we have to tell APL to treat it as a function because it reads this as the two-train atop
(needed/) ⊢This led me in steps to
needed (/⍨⍨) ⊢which worked but then I saw what I was doing and finally came up with
squeeze ← ⊢ (/⍨) neededwhich is a full 25% quicker than its dfn equivalent. I'm beginning to see the argument for a separate glyph for the function compress/replicate as opposed to operator reduce/insert.
p.s. with
]box -trains=parenswe get
squeezewhich would be perfect with an extra quote. I can't complain as my attempt at an operator to represent dervs generally produces nonsense with array operands.
⊢(/⍨)(((≠\)('''=⊢))≥(' '⍷⊢))
-
Phil Last - Posts: 624
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
1 post
• Page 1 of 1
Return to Functional Programming
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group