@Adám well, performance impact depends on the point of view :) I think it has
@Adám the compiler to bytecode partially improves the situation; it can handle the "clean" cases and gives up on the "too dynamic" legacy of apl - things like expunging (deleting) local variables, which were probably the reason for shadow blocks
And therefore, basing whether a language is alive or dead off of when the last stable release was, as listed on the wikipedia page is a little bit iffy. And yeah, they really should.
@cairdcoinheringaahing I hope so :P I honestly wish the election was just over. At this point, there's so little activity, the only thing I can do is wait, and it stresses me out to think about losing
@Claudiu: Well, that's up to its creator. If I designed my own golfing language, I think I would make it bit-based or encode all instructions arithmetically. — Dennis ♦Aug 21 '14 at 23:30
Maybe I'll have the time built-in push the timestamp, second, minute, hour, day of week, day of month, month, day of year, year
That way if I want just the timestamp it's at the top.
Or maybe have it rip the top value from the stack, and if it's zero or nan (or the stack is empty) push the current date info and timestamp, otherwise push the date info for the timestamp taken from the top of the stack and push the current timestamp
The Challenge
Given a number, find the sum of the prime numbers in the Fibonacci sequence up to that number, and find the prime factors of the sum.
For example, if you were given 8, the prime numbers would be 1, 1, 3, and 5. Adding these up would get 10. The prime factors of 10 are 2 and 5, so ...
Guidelines
Task
Given two notes, inputted as strings or lists/arrays, calculate how many semitones apart they are (inclusive of the notes themselves), outputting as a number.
Examples
'A, C' -> 4
'G, G#' -> 1
'F#, B' -> 6
'Bb, Bb' -> 13
Rules
The largest distance between two notes i...
Well, it's up to you. It just doesn't seem like the kind of language that enough people golf in to know a lot of useful golfing tricks. Most Hexagony golfing seems to be quite ad hoc.
Half of the progress I make I have to earmark as "revisit this later and make it elegant" which is mildly disheartening, but at least it still compiles, and it's only half.
Stack Cats is a reversible, stack-based language. Its reversible nature makes for somewhat weird loops. This challenge is about the conditional loop (...). When these loops are nested in certain ways, it's possible to transform the code to reduce the nesting depth. Here are the rules (where A and...
@ASCII-only Instead of parsing to (Operator (Binary Multiplication)), which I need to handle case-wise, I can deconstruct this as (Operator (Binary op)), and apply the multiplication as op
Circular tapes are exciting
code-golf brainfuck
A Brainfuck derivative
Let's define a simple Brainfuck-like programming language.
It has a two-directional tape of cells, and each cell holds one bit.
All bits are initially 0.
There is a moving head on the tape, initially at position 0.
A prog...
@Potato44 Strict to the last constructor that the function will always observe. The . means "whatever strictness and uniqueness information the dynamic type following it has".
If you have any crazy ideas, I'm open to trying them. Until I can figure out a way to link it to the World properly, it'll be really funky to optimise without breaking it completely.
@Potato44 Oh. I didn't try using unsafePerformIO. That works a lot better than accUnsafe. Thanks.
@Οurous I don't know how well it translates to clean, but maybe how I do IO in my brainfuck interpreter might be useful. My steo function has a similar shape to your process function
@Potato44 tio.run/##S0oszvj/PzU5I1/B1lYh1C/… this should help, they're both direcly implemented in ABC because it's the only way to circumvent the type system. unsafePerformIO cannot be optimised at all, accUnsafe can
If I expand out the IO as well, which I belive is safe to do in Clean, the type of my step function is basically Command -> Tape a -> *World -> (((), Tape a), *World) using a mix of Haskell and Clean syntax
@Dennis do you think I should accept the 05AB1E port instead? It's the earliest 4 byte solution, and it uses Neil's approach. If the shortest answer of all is a port, as well as the shortest answer in most other languages are ports, then I think the original post should be accepted (if any). I'll un-accept if someone posts a shorter Python answer, in which case no answer will be chosen as the winner.
@Dennis I've actually considered going through all my old code-golf challenges and un-accept answers, but I'm afraid that will flood the front page, and I don't want to do that.
wait, if I make an interpreter read a program in UTF-8 by default and need a flag to use the custom code page, do I have to add the flag in submissions?
So, I wrote myself a one-liner which printed out a snake on the console. It's a bit of fun, and I wondered how I might condense my code...
Here's a (short) example output:
+
+
+
+
+
+
...
Let's solve the flag problem once and for all
Rather than dealing with inconsistent schemes for adding flags, let's just consider each separate invocation of a compiler/interpreter/whatever a separate implementation (and thus a separate language by our rules).
This comes with many benefits:
T...
HTTPS always matters unless the site has absolutely no form of input, be it either given by the user, or automatically fetched by the user's logins (e.g. social buttons such as the Facebook "Like!" button)
and, even then, you don't know what you're giving away
@betseg depends on the scope of your project. for simple single-file programs, I prefer to avoid forward declarations (because duplication is annoying when you need to change stuff). for larger projects, the declarations probably go in a header file anyway, and then you can order the functions however you wish.