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 user‭

Type On... Excerpt Status Date
Edit Post #282438 Initial revision almost 3 years ago
Answer A: Evens or Odds - you know this one
Scala `-language:postfixOps`, 2 bytes ```scala 1& ``` Try it online! 1 for odd, 0 for even. Scala, 3 bytes ```scala %2 ``` Try it online! 1 for odd, 0 for even.
(more)
almost 3 years ago
Edit Post #282319 Post edited:
almost 3 years ago
Edit Post #282319 Post edited:
almost 3 years ago
Comment Post #282319 @#53196 Whoops, didn't realize that. Off-by-one errors are the two things I hate most :P. And yes, the input will be an array and a set of indices.
(more)
almost 3 years ago
Comment Post #282319 @Moshi Thanks for reviewing my draft! About your first comment - that's not a mistake, the 5 is exclusive, but I'm removing that part anyway, since it won't be a contiguous subset anymore.
(more)
almost 3 years ago
Edit Post #282319 Initial revision almost 3 years ago
Article Shuffle a subset of a list [FINALIZED]
Posted Idea shamelessly stolen from caird and rak1507 Shuffle a subset of a list of unique, positive integers with uniform randomness, given the indices of that subset. For example, given the list \$[A, B, C, D, E, F, G, H]\$ and the indices \$[0, 3, 4, 5, 7]\$ (0-indexed), you would extract th...
(more)
almost 3 years ago
Edit Post #281960 Post edited:
almost 3 years ago
Edit Post #282249 Post edited:
almost 3 years ago
Edit Post #282249 Post edited:
almost 3 years ago
Edit Post #282249 Initial revision almost 3 years ago
Answer A: Are they abundant, deficient or perfect?
Vyxal, 30 28 25 bytes Saved 1 4 bytes thanks to Aaron Miller ``` ƛ∆K-±";£kɽƛ¥D„£'t¥=;vṪ,£ ``` Try it Online! A rather pitiful answer, but hey, it works. Gives deficient numbers, then perfect numbers, then abundant numbers. ``` ƛD∆K-±$";£ ƛ ; #For every n...
(more)
almost 3 years ago
Edit Post #282246 Post edited:
almost 3 years ago
Edit Post #282246 Initial revision almost 3 years ago
Answer A: Are they abundant, deficient or perfect?
[APL (Dyalog Unicode)], 21 bytes {×⍵-+/∪⍵∨¯1↓⍳⍵}¨∘⍳⊢⌸⍳ Try it online! Returns a matrix (padded with zeroes) where the first row is deficient numbers, the second is perfect numbers, and the third is abundant numbers. ``` {×⍵-+/∪⍵∨¯1↓⍳⍵}¨∘⍳⊢⌸⍳ ⍳ ⍝ Make a r...
(more)
almost 3 years ago
Edit Post #282168 Initial revision almost 3 years ago
Answer A: Diagonalized alphabet
[APL (Dyalog Unicode)], 31 bytes ⎕←↑(14↑(2⌷x),⍨⌽)¨,\1⌷x←⍉13 2⍴⎕A Try it online! Lot worse than the BQN answer. ``` ⎕←↑(14↑(2⌷x),⍨⌽)¨,\1⌷x←⍉13 2⍴⎕A ⎕A ⍝ String of uppercase letters 13 2⍴ ⍝ Turn that into a matrix where...
(more)
almost 3 years ago
Edit Post #282081 Post edited:
almost 3 years ago
Comment Post #282081 @Hakerh400 Thanks, I don't know how I missed that.
(more)
almost 3 years ago
Edit Post #282081 Post edited:
almost 3 years ago
Edit Post #282081 Post edited:
almost 3 years ago
Edit Post #282081 Post edited:
almost 3 years ago
Edit Post #282081 Post edited:
almost 3 years ago
Edit Post #282081 Post edited:
almost 3 years ago
Edit Post #282081 Initial revision almost 3 years ago
Answer A: Evaluation order of an APL n-train
[Haskell], 52 48 45 42 bytes Caught mistake thanks to rak1507 Saved 3 bytes thanks to Hakerh400 f n=n:g[n-1,n-2..1] g(b:c:t)=c:b:g t g t=t Try it online! `g` takes the rest of the trains. ``` -- This is a fork, so append c (monad) and b (dyad) -- and continue w...
(more)
almost 3 years ago
Comment Post #282075 Is it alright if we number them `n..1` instead of `1..n`?
(more)
almost 3 years ago
Edit Post #281960 Initial revision almost 3 years ago
Answer A: Backspace an array
[JavaScript (Node.js)], 41 40 bytes Saved 1 byte thanks to Shaggy x=>x.map(e=>e?a.push(e):a.pop(),a=[])&&a Try it online! ``` x => //x is the input x.map(e=> //For every element e in x e? //If e is not 0 a.push(e) //Add it to the accumulator :a.pop(), //Other...
(more)
almost 3 years ago
Comment Post #281958 You can get this to [62 bytes](https://tio.run/##K6gsycjPM7YoKPr/P802JzE3KSVRoUIn0TY61ipNoyLa0CpWJ1E7uiLaIDY2M00BRKfmFKcqJEZb6RrGaoKEFCAC/wuKMvNKNNI0og10YNBUxzxWU5MLLmOoYwQUNUYTMwVCA7CMgY4FhnpjHROwjCUWk6AQKPMfAA), and probably lower with Python slice black magic.
(more)
almost 3 years ago
Edit Post #281957 Post edited:
almost 3 years ago
Edit Post #281957 Initial revision almost 3 years ago
Answer A: Backspace an array
Scala, 45 bytes ```scala ./:(Seq[Int]())((a,x)=>a:+x dropRight-x2+2) ``` Try it in Scastie! I couldn't find a way to use underscores in the inner function :(. Explanation on its way. ```scala //The input ./:( //Fold over it, Seq[Int]() //starting with an empty list, )( ...
(more)
almost 3 years ago
Comment Post #281721 Nice! You can get [71 bytes](https://tio.run/##ZVJda4MwFH33V1wCAzMCbZImfmy@7nnvIkHWuAk2Wk0fxuhv764fbS0VYszJ9Zxzc9L9@p/Wyctlbyuowo45mjZZ7l67zeYIVdsjdKS1gw7qCtzL8Z0Xb731p95N5U2@LSjuNGCbwYKbeLwdfDi@vsrB0jQAfLq@dneQgXX7jKRA6GqXfJbDYPdklKputTnp@va7Lw@kYHAHa9edPCkoZNkKbU9@gmc75KOsGySkQTD6OpS1Cxc/1184ZPAHN4...
(more)
almost 3 years ago
Edit Post #281608 Post edited:
I'm an idiot
almost 3 years ago
Comment Post #281608 @Razetime I'm an idiot, thanks!
(more)
almost 3 years ago
Edit Post #281608 Post edited:
almost 3 years ago
Edit Post #281595 Post edited:
almost 3 years ago
Edit Post #281608 Initial revision almost 3 years ago
Answer A: Juggler sequences
Scala, 78 67 64 bytes Saved 3 bytes thanks to Razetime ```scala Stream.iterate()(x=>math.pow(x,x%2+.5).toInt).takeWhile(>1):+1 ``` Try it in Scastie! ``` Stream.iterate() //Make an infinite list by repeatedly applying (x=> //the following function to the input math.pow(x...
(more)
almost 3 years ago
Edit Post #281595 Initial revision almost 3 years ago
Answer A: Golf a FRACTRAN interpreter
[APL (Dyalog Unicode)], 33 bytes {×x←⊃(2⌷⍵)(÷⍨(/⍨)0=|)⍺×1⌷⍵:x∇⍵⋄⍺} Try it online! The first case doesn't work because it gets really big, but the other two do. The input is taken on the left and the fractions are taken as a table on the right. ``` {×x←⊃(2⌷⍵)(÷⍨(/⍨)0=|)⍺×1⌷⍵:x...
(more)
almost 3 years ago
Comment Post #281572 I don't understand how the second test case can ever terminate. Since there is a fraction 55/1 at the end and two integers produce an integer when multiplied, it would never get past that fraction.
(more)
almost 3 years ago
Edit Post #281550 Initial revision about 3 years ago
Answer A: Make my number a set
[Haskell], 51 31 bytes Saved 20 bytes thanks to Hakerh400! data S=S[S] f i=S$map f[0..i-1] Try it online! `S` is a recursive data structure, because sets of varying element types can't be represented with simple lists in Haskell.
(more)
about 3 years ago
Edit Post #281536 Initial revision about 3 years ago
Answer A: Make my number a set
[APL (ngn/apl)], 6 bytes {∇¨⍳⍵} Try it online! Dyalog APL and dzaima/APL appear to not give empty vectors for `⍳0`, so I used ngn/APL. I don't know how to turn on boxing there, though, so there's extra processing code in the footer. ``` {∇¨⍳⍵} ⍵ ⍝ The input ⍳ ⍝ Mak...
(more)
about 3 years ago
Edit Post #281498 Post edited:
about 3 years ago
Edit Post #281498 Initial revision about 3 years ago