Skip to main content
Stack Overflow
  1. About
  2. For Teams
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Return to Answer

deleted 161 characters in body
Source Link
Tobia
  • 19.1k
  • 7
  • 83
  • 101

APL: 59

This function accepts a number and returns the two expected items. Works correctly in bonus cases.

{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1}

Dialect is Dyalog APL, with default index origin. Skill level is clueless newbie, so if any APL guru wants to bring it down to 10 characters, be my guest!


You can try it online on Try APL, just paste it in and put a number after it:

 {⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1} 13
┌→────────────────────────┐
 *************
 *******************
 *********************
 ***********************
│*************************│*************************
│*************************│*************************
│*************************│*************************
│*************************│*************************
 ***********************
 *********************
 *******************
 ************* ↓
├────────────────────────→┤
│22.98225 │
└~────────────────────────┘

APL: 59

This function accepts a number and returns the two expected items. Works correctly in bonus cases.

{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1}

Dialect is Dyalog APL, with default index origin. Skill level is clueless newbie, so if any APL guru wants to bring it down to 10 characters, be my guest!


You can try it online on Try APL, just paste it in and put a number after it:

 {⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1} 13
┌→────────────────────────┐
 *************
 *******************
 *********************
 ***********************
│*************************│
│*************************│
│*************************│
│*************************│
 ***********************
 *********************
 *******************
 ************* ↓
├────────────────────────→┤
│2.98225 │
└~────────────────────────┘

APL: 59

This function accepts a number and returns the two expected items. Works correctly in bonus cases.

{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1}

Dialect is Dyalog APL, with default index origin. Skill level is clueless newbie, so if any APL guru wants to bring it down to 10 characters, be my guest!


You can try it online on Try APL, just paste it in and put a number after it:

 {⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1} 13
 *************
 *******************
 *********************
 ***********************
*************************
*************************
*************************
*************************
 ***********************
 *********************
 *******************
 *************
2.98225
Source Link
Tobia
  • 19.1k
  • 7
  • 83
  • 101

APL: 59

This function accepts a number and returns the two expected items. Works correctly in bonus cases.

{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1}

Dialect is Dyalog APL, with default index origin. Skill level is clueless newbie, so if any APL guru wants to bring it down to 10 characters, be my guest!


You can try it online on Try APL, just paste it in and put a number after it:

 {⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1} 13
┌→────────────────────────┐
↓ ************* │
│ ******************* │
│ ********************* │
│ *********************** │
│*************************│
│*************************│
│*************************│
│*************************│
│ *********************** │
│ ********************* │
│ ******************* │
│ ************* ↓
├────────────────────────→┤
│2.98225 │
└~────────────────────────┘
Post Made Community Wiki by Tobia

AltStyle によって変換されたページ (->オリジナル) /