I think that applying the techniques in these two CMCs is sufficient to produce pretty much all my Underload answers at CGCC, normally I try to solve a problem with just those, and if I can't, I don't bother
but, there is more to the language
UMC: add two numbers (in Underload, taken as Church numerals from the stack). (Side note: there isn't an Underload answer to the main-site version of the question yet, so feel free to post your answer once you have it.)
Underload
Underload is a stack-based tarpit esolang, which can be a good choice for some problems (especially quines) and a horrible choice for most of the others (but even horrible choices can be fun to golf in!). If you're planning to use it at CGCC, here's what you need to know:
The basics
CGC...
hmm, the main-site "add two numbers" question requires handling negative numbers, probably that's why there are no Underload answers (because there's no standard way to represent them, that's consistent with the positive numbers in how they react to arithmetic)
I think the trick is to write a program that outputs 0 and exits, and a program that outputs 1 in a loop, and just use the input to choose between them
it looks like I posted an Underload truth-machine to the main site; advertised as "16 bytes" but I forgot the parens around the outside (as usual) so it's actually 18
when testing my own CMCs I often forgot the parens and wondered why the interpreter was segfaulting
(actually, I don't get why TIO's interpreter segfaults on stack underflow rather than having error handling…)
most practical languages don't have fun as a design goal
(when they do, we end up with things like Perl – apparently the actual reason barewords can be used as string literals is because it makes polyglots between Perl and poetry easier to write)
yeah besides deep frying i think olive oil works for pretty much everything; i think shallow frying with it is fine, you can use it as a salad dressing, as a beverage, etc
I hate how much the SO blog is basically just product placement
Although idk, I guess I'm fine with more ways for SE to make money that don't involve anything too harmful
But "A murder mystery: who killed our user experience?" seems like it'd be an interesting discussion of the issues people's experiences with SO or something, not an ad
Usually they're 24 hours I think, so that people from all time zones can participate (so you're definitely not expected to stay online thoughout the whole thing :p)
that's possible, but will be fairly long by golfing standards
you could use a few different characters for the unary in the input: I think : is easiest but ^ and a may also be daoble
unary to Church numeral thus shouldn't be too hard, and Church numeral to binary is definitely possible, but may be quite verbose (Church numeral to decimal has been done, but not in a golfing context as far as I know)
ooh, Church to binary could have some fairly fun algorithms, actually (especially if you can print the digits out in reverse order, although admittedly you probably can't)
the whole field of code golf would have been simplified considerably if people had adopted a little-endian notation, back when base-n numeric notation was first invented
a pity they didn't think that far ahead
this is an obstacle to golfing language design, because little-endian notation works much better in most algorithms, but problems written by humans tend to assume big-endian, and so you have to make tradeoffs between the two endianesses
at least in the asm I was working on recently, the big changes sometimes worked first time but sometimes had lots of subtle errors that took ages to fix
the "world's fastest fizzbuzz" that I spent months working on, when I was done I deleted all the comments and whitespace and recreated them, in order to make sure they were a) up to date, b) served as a good introduction for people reading the code for the first time, but mostly c) got the code down to under 64KiB so that I could actually post it
someone in the comments there managed 123GiB/s for yes, which seems about right for me based on my work in the FizzBuzz
(assuming that the length of the string you're printing is a power of 2, at least; y\n is)
the trick you can do with yes but not with FizzBuzz is to map the same physical page of memory into the pipe multiple times; normally this trick is only used for all-zero pages as a fast way to produce large amounts of zeroed memory, but it works for any other pattern whose repeat length is a factor of 4 KiB
for the FizzBuzz I basically had to invent a programming language that I could interpret using SIMD instructions, so that blocks of 32 bytes get calculated in parallel, with each calculation taking 2 clock cycles (actually AMD's Zen 3 microarchitecture can do it in 1, but it gets slowed down to 2 due to being bottlenecked on writing to L2 cache)
actually I think I vaguely knew about the kernel zero page beforehand
but, most of this isn't secret, you can find it with a web search once you've figured out the right questions to ask
Agner Fog's optimisation guide is pretty good if you're looking for a single thing to read, though
it's reverse-engineered internal details for most x86ish processors
not 100% accurate but pretty close
there's also the perf command (Linux-specific, there's probably a Windows equivalent) which lets you see what the processor is doing via collecting statistics on various parts of the internals, it can be a lot of fun
modern processors have a range of performance counters that just count various things happening internally, you can monitor up to four of them at a time
and learn, e.g., how many CPU cycles your program ran for, or how many memory accesses they made, or how many commands ran on execution port 6, etc.
but it's frustrating, because you can only check things that the processor manufacturer thought to measure, and often you have to rely on measurements that don't measure exactly what you want
and by "thought to measure" we of course mean "specifically selected to measure to best demonstrate the strengths of the chip whilst avoiding its weaknesses"
although, the reason they provide these things is to allow programmers to figure out what their program is bottlenecked on at the machine-code/microcode level, thus allowing them to work around the flaws of the processor and thus produce better benchmark results
Well uh...for my CS class I'm supposed to give a short presentation on RTO tomorrow, so I can show that I'm actually doing work in the class, but it's currently very broken lol
So I guess I'll be busy tonight
Even worse the school flipped the A and B days after the PSAT, so today I was supposed to have CS class today and I'd present on Friday, but now it'll have to be tomorrow
It's not for a grade but I'll look pretty stupid lol
huh, after looking up encodings for the halt-and-catch-fire instruction (defined as anything that requires at least a power cycle to get the processor back to working order), it seems that 0x0f 0x04 did that on the 286, and the opcode in question is still unused on Intel processors even nowadays
I'm vaguely tempted to try running it on my processor to see what happens (although I expect it'd just immediately SIGILL)
The Pentium F00F bug is a design flaw in the majority of Intel Pentium, Pentium MMX, and Pentium OverDrive processors (all in the P5 microarchitecture). Discovered in 1997, it can result in the processor ceasing to function until the computer is physically rebooted. The bug has been circumvented through operating system updates.
The name is shorthand for F0 0F C7 C8, the hexadecimal encoding of one offending instruction. More formally, the bug is called the invalid operand with locked CMPXCHG8B instruction bug.
== Description ==
In the x86 architecture, the byte sequence F0 0F C7 C8 represents...
although it was possible to fix that one in software via doing really weird things with the interrupt table
(and sandsifter apparently found one in 2017, but it was kept secret for fear it might be used maliciously – I wonder if it's been fixed yet, and when it'll become public)
if you google "i'm fishing for hats" with quotes, the only result that shows up [besides omitted results] is this SO thread. the quote is located in the comments on the question. is this stack exchange slang? what did they mean by this
@RedwolfProgrammed It's obviously not based on a true story because the protagonist has a bunch of shirts that all look the same. No real person/bee could tolerate that
But sometimes you want something else, so I'd consider a builtin which takes two args (an object X and a default value Y), and if X is empty then gives Y as the value instead