Potential error or improvement to exercise G6
Open
- Dominant language
- Python
- Stars
- 46
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
Reported by user via email:
The proposed solution to G6 (Ontop) crashes if the given title is longer than the width of the matrix:
```
'hejsansvejsan' Ontop MonMat
DOMAIN ERROR
Ontop[3] title←((⌈nb)⍴' '),X,((⌊nb)⍴' ')
```
FWIW here’s what I coded (which may break in other ways, I’m noob)
```
OnTop ← {
cols ← (⍴⍺) ⌈ ⍴⍵[2;]
expand ← {
width ← ¯1↑⍴⍵ ⍝ hacky way to get line length of vec and mat
offset ← ⌊(cols-width)÷2
vec ← cols⍴0
vec[offset+⍳width] ← 1
vec \ ⍵
}
(expand ⍺) ⍪'-'⍪ expand ⍵
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.