Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for Peter Taylor‭

Type On... Excerpt Status Date
Comment Post #291538 Actually some of those optimisations might not work because the brackets appear to be doing weird things.
(more)
4 months ago
Comment Post #291538 Consider test case `"XCCD"`. The correct output is `XCC` but this regex matches `XCCD`. Fixing the bug actually helps to golf the regex. (FWIW there is further golfing which is possible by combining cases. I'm not sure what the optimum is, but `(.)\1{3}` knocks out `IIII|MMMM|XXXX|CCCC`, and the vari...
(more)
4 months ago
Comment Post #286920 I'm used to a culture of code golf which is collaborative.
(more)
about 2 years ago
Comment Post #286920 The `sum(map(int` trick is shorter than I'd managed, but itertools is expensive. As a one-liner, a recursive lambda gets 76: `f=lambda n,i=1,a=[]:a if a[n-1:]else f(n,i+1,a+[i][i%sum(map(int,str(i))):])`. But if you don't insist on a list, the best I've found is an explicit loop for 73: `def f(n,i=0)...
(more)
about 2 years ago
Comment Post #285231 It's always sensible to remove bounds on the input so that hard-coding isn't a strategy and implementations have to actually tackle the problem rather than side-step it.
(more)
almost 3 years ago
Comment Post #283796 You can save 9 bytes with base case the 0x0 matrix and 2 bytes with `enumerate`: it's long, but so is `range(len)`. For 95 bytes: `f=lambda m:sum((-1)**i*x*f([r[:i]+r[i+1:]for r in m[1:]])for i,x in enumerate(m[0]))if m else 1`
(more)
about 3 years ago
Edit Post #284209 Post edited:
Improve MathJax formatting
about 3 years ago
Edit Post #284209 Initial revision about 3 years ago
Answer A: Compute the determinant
CJam, 45 bytes {:A,{1$,,.=:+\)/:CAffA@zf{\f.::+}..-}/;C} This implementation is an anonymous block (function). Online test suite%2F%3ACAffA%40zf%7B%5Cf.%3A%3A%2B%7D..-%7D%2F%3BC%7D%0A%0A%3AD%3B%0A%5B%5B1%200%5D%5B0%201%5D%5D%20Dp%0A%5B%5B1.5%202%5D%5B-3%204.5%5D%5D%20Dp%0A%5B%5B3%207%5D...
(more)
about 3 years ago