Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
2
votes
Create an ASCII line, given a length
Python 3.8 (pre-release), 46 bytes
for i in range(int(input())):print(' '*i+'\\')
Try it online!
3
votes
Print a 10 by 10 grid of asterisks
51AC8, 10 bytes
10[10\*×t]
Try it Online!
Explanation
10[10\*×t]
10 # Push 10 (for each loop; looping var)
[ # Begin foreach loop (for 10 times)
10 # Push 10
\* # …
3
votes
Print a 10 by 10 grid of asterisks
K (ngn/k), 16 14 13 bytes
` 0:10 10#"*"
Try it online!
Thanks to @Bubbler in the k tree for helping me out with this.
¯2 bytes thanks to @Bubbler
¯1 byte thanks to @Bubbler
2
votes
Repeating slices of an array incrementally
Python 3, 71 bytes
g=lambda x,s=1:[[c for c,_ in zip(x,range(s))]]+g(x[s:],s+1)if x else[]
Try it online!
-3 Thanks to @U12-Forward
2
votes
Create an ASCII line, given a length
BQN, 14 11 bytesSBCS
" \\"⊏˜↕=⌜↕
Run online!
¯3 thanks to @ovs
6
votes
Create an ASCII line, given a length
51AC8, 10 bytes
R[\ ×\\+t]
Try it Online!
-2 bytes due to an update.
-7 bytes due to an update introducing for_each loops and range.
-1 byte online interpreter and implicit input.
Explanation
…
2
votes
0
answers
104
views
Tips for golfing in Fennel
Fennel is a lispy language which compiles to Lua.
From its page:
Fennel is a programming language that brings together the speed, simplicity, and reach of Lua with the flexibility of a lisp syntax an …
1
vote
Rotate a number
K (ngn/k), 29 25 bytes
{.(y#a),(y:-(#a)!y)_a:$x}
Try it online!
¯4 thanks to @ovs
4
votes
Is this a function?
K (ngn/k), 11 bytes
{r~?r:*'?x}
Try it online!
Port of chunes' factor answer.
Explanation
{r~?r:*'?x}
{ } /function
?x /distinct values
*' /first value of each
…
2
votes
Reduce using the lowest value
K (ngn/k), 8 bytes
{x-x@<x}
Try it online!
0
votes
Number to Binary
flax, 1 byte
B
Attempt This Online!
Builtin
22
votes
53
answers
3k
views
Create an ASCII line, given a length
Information
Create a diagonal line given its length (let’s call the variable, say, \$n\$ where \$n > 0\$)
The diagonal line starts from the top left and goes to the bottom right.
You must use the ASC …
1
vote
Transpose a 3x3 matrix across the anti-diagonal
flax, 2 bytes
Ṙ∝
ATO doesn't have the lastest commit of flax (because I keep discovering bugs). So here is an image of it in action:
1
vote
Is it a balanced number?
flax, 7 bytes
EṠXFz˘D
Port of the 05AB1E answer. Ties with jelly. No online link as the latest commit is not on ATO.
Explanation
EṠXFz˘D
D ⊳ Digits
z˘ ⊳ Zip with itself
F ⊳ Flat …
6
votes
Fibonacci-like gap formula
Python 3.8 (pre-release), 60 58 bytes
lambda u,v,a:[(p:=u/2-(u*u/4+v)**.5)**a+(u-p)**a,-(-v)**a]
Try it online!
¯2 thanks to @tsh
Originally based on @tsh's answer (now removed due to no complex num …