Skip to main content
Keen's user avatar
Keen's user avatar
Keen's user avatar
Keen
  • Member for 10 years, 7 months
  • Last seen more than a month ago
answered
Loading…
comment
Code that will only execute once
@KyleKanos It gets the filesystem module fs and the current filename __filename and removes that filename from the filesystem.
comment
Code that will only execute once
If you need to rearrange the #s element, it should be okay to just do h=s.innerHTML=s.innerHTML.replace("h","g").
comment
Code that will only execute once
Given that reloading the page is allowed, and your goal is only to prevent h from being executable more than once while it's already loaded, what's wrong with function h(){h=0}?
comment
Print the prime factorization of the greatest common divisor of two numbers
Certainly. In practice I'd only use a recursive function if I really needed some kind of stack, like for tree navigation or other inherently recursive data-structures. (Sure, numbers can be treated as recursive data-structures, but we have all kinds of nice abstractions to help us ignore that fact.)
revised
Loading…
revised
Loading…
revised
Loading…
comment
Print the prime factorization of the greatest common divisor of two numbers
That function syntax is so enviable. One day it will be mine.
comment
Print the prime factorization of the greatest common divisor of two numbers
Under the preexisting rules, one could say that this implementation omits the requirement "Output nothing if the inputs are relatively prime." Still seems wrong to deface golf code that came out so pretty. How brief can you make a filter() call?
revised
Print the prime factorization of the greatest common divisor of two numbers
Add comments to ungolfed code; clarify language version; amazing idea to shorten the arbitrary function name
Loading…
revised
Loading…
awarded
awarded
revised
Loading…
awarded
revised
Loading…
Loading…
1 2
3