@Mr.Xcoder I.e. for a language which cannot really handle functions as first-class objects, they could take a "function" as a string where one argument is presumed on the far left and the other on the far right, then do string concatenations and evaluate.
@Mr.Xcoder Frankly, I'm not too concerned about loopholes any more. We've covered the most serious ones, and the worst that can happen is that a few people get some unwarranted rep.
@Mr.Xcoder Maybe I should be a bit more specific about possible formats the function could be given as?
well, only languages with higher-order functions can participate, and those support the FP paradigm to some degree (even if they're primarily imperative)
@MartinEnder I don't see the problem. Every language (which can participate) has the concept of expressions. Whatever a valid expression is (after substitution of placeholders) forms a "function".
Orient the Rubik's Cube
code-golfrubiks-cubestring
Introduction:
I collect twisty puzzles, so I'm quite the fan of rubiks-cube-challenges (even though most are fairly difficult). So, let's try a fairly easy rubiks-cube-challenge for a change.
When an NxNxN Cube gets scrambled during a WCA (Wo...
@Adám but then you leave it up to the participants to define what a placeholder is. I'm just expecting answers that'll do a plaintext substitution of x and y for the arguments, messing up exp or max in the process.
well if I just replace all x with the input, exp could become e5p
or they might get inserted into strings. the point is, you can't just do string manipulation, you'd actually have to parse the entire expression, which frankly no one is gonna do, so you might as well restrict the challenge to actual function objects
if you don't specify what the functions are, then answers should be able to support the function f(x1, x2) = x1 + x2 + len("zyx123"), no? it's a function with the required domain and range.
Because they are not allowed to read the function's source anyway, but analyse its values instead. How the black-box function is implemented is the problem of the person testing it.
no important ones. pretty much every mainstream language has some form of higher-order function, and many esolangs do as well. of course you'll include a whole bunch of the more barebones esolangs, but I don't see that as a problem.
providing a nice challenge about higher-order functions (for those languages that do support them) is more important than allowing every language to participate
@Mr.Xcoder Heh, I didn't realise that all languages can handle functions. In old traditional APL the only way was passing a name of a function and evaluate.
@MartinEnder True. OK, but then I need to remove my reference implementation, right?
shouldn't APL make it easy to write a reference solution as an operator? just extract the diagonal of the value argument and then fold the function argument over it?
@MartinEnder Obviously, but 1) I wanted an easy-to-understand reference 2) I wanted to demonstrate a non-FP solution 3) I don't want to give away a short APL solution.
@Adám What's the meaning of blackbox vs string-formulas here? Would it be okay for a program reading the function from input and executing it? Or does it have to be a function taking a function as a parameter?
we generally allow STDIN as an input source, so if your language does have a string representation for function objects, you can certainly read that object from STDIN
CMC: Convert from binary to a base-10 integer, without using built-ins that do that for you. This is a CMC, so Do X without Y shouldn't be a problem :P
@Adám I have a question: If I use Jelly, can I assume that the function is implemented in the link above (i.e prepended to the code with a separating newline or in the header?)
Inspiration.
Given (by any means):
A two-argument black box function, f: ℤ+ × ℤ+ → ℤ+ (input and output are 1, 2, 3,…)
A strictly positive integer matrix with at least two rows and two columns
return the matrix's function trace.
What is a function trace?
A normal matrix trace is the sum of...
@Mr.Xcoder actually no you can't "pre-populate" variables if you can otherwise input a function (which you can with Jelly's v, and I'm pretty sure it's possible, albeit too long, to make the function input a pair of values instead but call it as a dyadic function with the arguments being the elements of the pair), but you can have the function work on lists [x, y] instead of two arguments x and y if @Adám agrees, since that's not the main point of the challenge anyway
(btw am I the only one who has discovered this consensus is in effect and not the one Mr. Xcoder mentions? looks like a common misconception to me, unless votes have fluctuated since then, which isn't too far in the past)
actually the consensus is this, which is a bit more complicated
and, even though Jelly doesn't technically have first-class functions, I don't think you're allowed to use ç (which isn't a name, but a quick which means "the link on top of this one"), and functions must be re-usable in order to be valid...although in Jelly functions do actually have a name, and that is their line number (modular indexing), so maybe using ŀ (quick which takes an index and executed the function at that line) is allowed
@EriktheOutgolfer Functions need to be reusable when your submission is a function. My answer would be a reusable function, I don't quite care about how they reuse the black-box.
well, I think assuming a specific position (e.g. line 3) is more appropriate than assuming a variable position (e.g. on top of the current line) (and I don't think the latter is valid)
Because my Jelly link (which constitutes my submission), is reusable. The fact that the black-box is not properly implemented is not my problem. It's like building the following in Python (as the black box function to be called)
200 reputation for a Triangularity quine.
I will award a bounty of 200 reputation to the first proper quine in the esolang I created, Triangularity. If you have succeeded writing such a program, please submit your answer Golf you a quine for great good! so I can award the bounty.
Personally, I ...
CMC: Given n, output valid Triangularity program with n lines, with "." as the padding character and (space) as the program content. Trailing newlines allowed.
Challenge
The challenge is to write a program that takes the coefficients of any n-degree polynomial equation as input and returns the integral values of x for which the equation holds true. The coefficients will be provided as input in the order of decreasing or increasing power. You can assume...
I'm going with the definition that user202729 gave for ▬. I might add another one for elements that are in one but not both
(elements that are in neither is monadic complement and it's not implementable without a different type because you can't list everything in existence :P)
Informal APL learning session tonight at 18:30 UTC in https://chat.stackexchange.com/rooms/52405/apl. See https://chat.stackexchange.com/transcript/message/41299896 if you don't have 20 Stack Exchange rep points.
What general tips do you have for golfing in uBasic? Any ideas that can be applied to code golf problems in general that are at least somewhat specific to uBasic. Please post one tip per answer.
Some helpful links
uBasic Wikipedia Page
Try it Online
@Mego now let's take it a step further. Suppose you're a reverse proxy. If you automatically decompress the response, then you still have to send it back to the client. It may make more sense to leave it compressed. That assumes the client sends an Accept-Encoding header though, I guess