The Nineteenth Byte

The Nineteenth Byte: General discussion for codegolf.stackexc...
yst 21:32
0
Q: Identify Last-Layer Perm of a Rubik's Cube

ngnA popular method for solving Rubik's cube consists of: solving its first two layers, by convention starting with the white side orienting the last layer's pieces so they face the same direction with their common colour - usually yellow, which is opposite white permuting the last layer's pieces...

Wed 20:19
0
Q: Equivalent Connect Four board generation

Юрыч BROConnect Four is a two-player game. You may read rules here if unfamiliar. A winning line is a line of 4 pieces of 1 color. A winnable line is a potential winning line of one color that is is not obstructed by opposite color pieces. A winnable line for red may look like one of these: For example,...

Wed 03:57
0
Q: Write two very different programs with the same characters

Steve BennettYour task is to write two programs/functions, in the same language. Program 1: Verify that two inputs are anagrams of each other. Program 2: Verify that two inputs differ from each other at every character position. "Verify" means, return a value you define as true for this case, and a different ...

Tue 18:12
0
Q: Make a Mulenère encryption program

QOO-OOKALANMulenère cipher is a version of Vigenère ciphers, which uses multipling instead of adding. Algorithm It's simple. First, the password will repeated as much as reach a size bigger than length of the text input. For encoding, ASCII code of each character of text will multiplied by the character in ...

Tue 17:36
0
Q: Print 100 digits of √1000

QOO-OOKALANYour challenge is to print any 100 consecutive digits of square root of 1000 (1000^0.5 or √1000). You must give the index at which that subsequence appears. The 31 is not included. For example, you could print any of the following: Index 1..100: 622776601683793319988935444327185337195551393252168...

Tue 16:54
0
Q: Unstablizable LaTeX

InQβfrom Latexmk: If you use cross-references, you often have to run LaTeX more than once ... Sometimes cross-referenced location changed and you need to run LaTeX again to create the correct reference. Then something else changed again and you need to run another time. This repeats until the outpu...

Jul 19 09:02
0
Q: Output shortest string containing all input strings

Steve BennettGiven a list of words (letters only) in no particular order, output the shortest string containing every word. Output must be lowercase, except the first letter of each word is uppercase. Input can be in any case you like. When there are multiple minimal solutions, output one. Code golf. Sample d...

Jul 18 01:40
0
Q: List of prime distances

JuanCaTask: Write a code golf program that, given two positive integers n and m, returns a list of the distances between consecutive prime numbers in the range [n, m] inclusive. Note: My question if different from this one Assumptions: 1 is considered the first prime number n<m Both n and m are inclus...

Jul 18 00:57
0
Q: This old underhanded one not closed or locked

LucenapositionSpeaking of underhanded questions, I wnoder how this one managed to evade the closed/locks that all others had faced: Pathological Sorting We thought underhanded stuff was off-topic and closed or locked as historical, but this one wasn't. Why?

Jul 16 12:26
0
Q: Are there any highly recommend talks or videos regarding golfing or golfing languages?

TedI'm always amazed by some of the techniques used in normal languages, as well as the density and conciseness of the manipulation done in golfing languages. Are there any recommended entertaining talks or videos which relate to golfing? I'm not necessary looking for a technical documentation or tu...

Jul 15 23:20
0
Q: Rig The Lottery, but Don't Get Caught

Albert RenshawRig The Lottery, but Don't Get Caught I have read a news story about a programmer who worked for the state lottery and various friends and family of his won the lottery on key dates where had programmed it to use specific numbers. He ultimately got caught. Assume you work for a sort of powerball ...

Jul 15 19:31
0
Q: Computing Pi with iF*ck

WarpPrimeObjective Compute \$\pi\$ using nothing but \$i\$ (\$\sqrt{-1}\$). Guidelines ONLY exponentiation and multiplication may be used (i.e. \$i^i\$ or \$ii\$) No additional symbols may be used (so no addition, subtraction, parentheses) The result must be real and cannot be complex. If the solution is...

Jul 15 08:16
0
Q: Who was leading the race?

TedYour goal is to find out the order of the drivers in a race (1st, 2nd, 3rd, etc) for each time the start / finish line is crossed. This would allow someone to see the progression of a driver throughout the race, for example if they started in 3rd, then fell backwards to 5th halfway through the ra...

Jul 14 06:51
0
Q: Tetris Tower — compute the final stack height in as few bytes as possible

jesseChallenge Brief In “classic” Tetris you drop one tetromino after another, optionally rotating / sliding it left or right before it locks in place. Your task is to take a finite piece sequence and report the final height of the stack (rows that contain at least one filled cell) after optimal place...

Jul 13 04:03
0
Q: The shortest NP-complete problem

Dannyu NDosFind an NP-complete problem that covers all finite ASCII strings, and present a solver for the problem in the programming language of your choice. By the definition, if there is a finite ASCII string input that yields an output that is neither truthy nor falsy, your submission is invalid. This pr...

Jul 12 19:25
0
Q: Minimalist Pokemon Type Chart

pacman256We have a few questions related to pokemon types, but the only one that has you print the type chart requires you to take a parameter for dual typings which adds a ton of complexity, switches the axes around from a standard type chart, and shuffled the type order. Thus, we should standardize it u...

Jul 11 13:29
0
Q: The Gather Operation

QOO-OOKALANThe Gather Operation You may take in input and output in any reasonable format. Output should be result after the gather operation. You may write a function or full program. You can use any other syntax you like for the gather operation if it supports full gather's parameters. This is code-golf, ...

Jul 11 02:28
0
Q: Output 200 words

Steve BennettOutput any 200 words from Wordnik without using external sources. Code golf.

Jul 10 23:50
0
Q: Is a JavaScript - C Polyglot possible?

DrParanoyaSince the C and JS have a very similar syntax, I wondered if it would possible to do a Polyglot with the 2. The JS should run in the console of a browser, and the C should compile with GCC.

Jul 9 17:29
0
Q: Is challenges which are too hard to solve not good?

QOO-OOKALANIs challenges which are generally1 hard to solve like this challenge not good and will downvoted? I assume the question is well and no problem on itself, just hard to solve. 1: A hard challenge is not a challenge which hard to solve in some languages, it's hard to solve in any language, after al...

Jul 8 09:57
0
Q: Stack Overflow Challenges

simonalexander2005Stack Overflow have started a beta "challenges" page - see https://stackoverflow.com/beta/challenges Have there been discussions about how that overlaps with this community, or if we want it to?

Jul 7 03:41
0
Q: Squid Games Season 1: Glass Briddge and VIPs

BeidouWelcome VIPs to the 33rd Squid Games. Players from the following numbers sequentially 21, 62, 67, 87, 96, 101, 151, 202, 218, 244, 308, 322, 360, 407, 453, 456 were given shirts to choose from numbers 1-16. Here is what they chose: #1 #2 #3 #4 #5 #6 #7 #8 096 308 062 021 453 244 151 407 ...

Jul 6 14:13
0
Q: Follow the glider

l4m2 Generate four 2D arrays that follows a glider in Conway's life of game. Each cell is 3x3 plus 1-width border. Each frame, it advances 1 cycle and shift the image by 1/4 cell, aka. 1 pixel. After 4 cycle it returns to original state. Use three values in output to mean white, black and grey(cell ...

Jul 5 16:43
0
Q: Genshin Elemental Aura Decay

BeidouThere is this game Genshin Impact, when an element is applied to an enemy i.e. Electro it remains for some time causing decay to the enemy health. For this challenge, we'll simplify this to a single integer representing the "aura strength" and a fixed "decay amount" per "tick." When the aura stre...

 
Tue 07:01
0
Q: Prior Art on implementing memory arenas or thread- or work-package-local allocators in systems programming languages

feldentmLocal allocators can be beneficial in situations where tracking memory usage or releasing all allocated memory without running destructors at the end of an activity is possible. From that perspective, a memory arena, a custom thread-local allocator and a work-package-local allocator (e.g. Runnabl...

Jul 17 18:46
0
Q: What AI can help compiler implementors

Hydroper ResidentI'm overloaded with lots of stuff to implement for a language, and I'd find it easier to use natural language to implement it, perhaps prompting an existing AI with a huge specification and some existing resources it can reuse (like my parser) for building a type checker and maybe a build system....

Jul 17 18:11
0
Q: Is it worthy generating a header for third party libraries's sources?

Hydroper ResidentIn a specific language's build system (or package manager), checking third party sources (whether local or from a package registry) can be done in different ways. NPM forces libraries to transpile TS/TSX to JS before being relied on due to the tsconfig.json configuration (which is ignored in thi...

Jul 17 07:05
0
Q: What are tho pros of cons of dominator Phis vs predecessor Phis

feldentmPhi nodes join data flow based on incoming control flow edges. Determination of incoming control flow can be encoded either by directly listing predecessors or by listing blocks dominating predecessors. Since predecessors dominate themselves, that encoding is trivially convertible to dominator en...

Jul 15 13:00
0
Q: What makes a language "golfy"?

RhaixerWhat metric, what objective, do language developers of golfing languages like Vyxal, Jelly, etc. focus on optimizing when developing their languages to be as "golfy" as possible? "Reducing bytecount" is not the answer I'm looking for - that's the overall point of these languages. What measures do...

Jul 14 09:05
0
Q: Why are there different typeclass hierarchies?

nicotyWhat's the history and reasoning behind the differences in the typeclass hierarchies in various functional programming language standard libraries? For instance, why does Applicative in Haskell extend Functor and require function definitions for pure and (<*>), whereas Applicative in PureScript e...

Jul 13 12:06
0
Q: Should I defer for metavar compounds?

Hydroper ResidentI've previously asked Compile-time reference resolution across Java-like packages. One of the answers unfortunately give a long paper, but it mentions about lazy caching, which I suppose I've done in my previous type checker (e.g. to avoid duplucate diagnostics; to skip certain type checking step...

Jul 11 17:18
0
Q: How to compile to preemptive coroutines?

JonasI am interested in the concept of stackful coroutines, as how it is used by the developer in a language. I have learned that Erlang and Go (perhaps some other languages) does have preemptive coroutines. As how I understand it, those "tasks" have "safe points", injected by the compiler where they ...

Jul 9 17:04
0
Q: “return(x);” vs. “return x;”

Rāqibu'l-QamarIn most C-like languages, a call such as printf("%d", x) is followed by two parentheses; and I see that return(x); would be ugly compared to return x;, but why is the inconsistency?

Jul 9 14:10
0
Q: What can I do to avoid capture of "outdated state" in a reactive-UI collaborative language?

Hydroper ResidentIn my language, for its official implementation, I'm planning to support an approach like React.js's one, which, I admit, looks more cryptic than approaches like (.NET XAML)/(Adobe MXML) if code comments aren't added, but well, other than that it looks okay. I'd like to know if there is a better ...

Jul 9 13:57
0
Q: What can I do to avoid capture of "outdated state" in a reactive-UI collaborative language?

Hydroper ResidentIn my language, for its official implementation, I'm planning to support an approach like React.js's one, which, I admit, looks more cryptic than approaches like (.NET XAML)/(Adobe MXML) if code comments aren't added, but well, other than that it looks okay. I'd like to know if there is a better ...

Jul 8 13:38
0
Q: DOM component source files versus inline markup for abstraction

Hydroper ResidentIn Adobe Flex (now Apache Flex and Apache Royale) there is support for ActionScript 3 and MXML files in MXMLC. MXML is used for describing UI components, where the root element tag is equivalent to defining a class that extends the type indicated by the tag, something like: <!-- src/HelloWorld.mx...

Jul 8 06:16
0
Q: How to design a grammar for a closely binding null-coalescing operator?

DannyNiuI'm prototyping a language that is memory safe by managing all pointers (details irrelevant here). I want to have a null-coalescing operator with high precedence, it should bind more closely than almost all other operators, so that individual variables can be "substituted" as needed without redun...

Jul 7 11:16
0
Q: Why do most languages have a complete operator precedence?

mousetailI actually drafted most of this question before the relavent stack overflow question but it's still relevant C has a famously confusing operator precedence order. . It is divided into 15 levels and within the levels there is a clearly defined associativity. Post programmers don't fully remember t...

Jul 6 20:18
0
Q: Type variables, metavars and base types in type theory

Hydroper ResidentAs a follow-up to How should I read type system notation? (since it doesn't give depth on that) Type variables An algorithm I'm trying to understand uses the $\alpha$ and $\beta$ symbols to denote type variables, and at the same time the paper also uses $A, B, C$ symbols to denote types. What are...

Jul 6 20:02
0
Q: Types versus type variables in type theory

Hydroper ResidentAn algorithm I'm trying to understand uses the $\alpha$ and $\beta$ symbols to denote type variables, and at the same time the paper also uses $A, B, C$ symbols to denote types. What are exactly "type variables" versus "types"? E.g.: Are they locations holding a type at compile-time so that they...

Jul 6 17:19
0
Q: How to implement a type system suitable for bidirectional type-checking?

Hydroper ResidentContinuing from the question How does bidirectional typechecking for higher-ranked polymorphism work? I'm very used to build type systems in an immediate way, where types are usually nominal and structural ones just interned (although I won't intern at all anymore due to factors like doc. comment...

Jul 6 15:00
0
Q: How are auto-boxed primitives treated as base types?

Hydroper ResidentIn my language everything except $\text{undefined}$ and $\text{null}$ are auto managed objects extending a very broad class, where primitives like numerics and booleans are auto-boxed as needed. Of course union types are not necessarily $\in \text{the broad class}$. In type theory they often call...

Jul 2 20:12
0
Q: What algorithms/approaches are known for type inference with subtyping (i.e. semiunification) of non-Turing-complete languages?

David DurschlagWhat are some options for integrating subtyping with Damas-Hindley-Milner inference? gets into this tangentially at the end of Jon Purdy's post ("Placing various restrictions on recursion (acyclicity)"). If not specific algorithms, general approaches would be appreciated. I am guessing having onl...

Jul 2 12:43
0
Q: Does JavaScript outperform decent for a compiler implementation?

Hydroper ResidentI've done some noob work in JavaScript before and it took around 1 minute to type-check, but there are the following to take: I wasn't following V8's inline cache optimization guidelines. And for a dumb reason I was doing prototype work manually instead of using classes directly. I decided not t...

 

  The Nineteenth Bakery

Trash for The Nineteenth Byte (commonly known as TN🍞)
Jul 15 16:55
0
Q: Is this code right and i need output

JitheshShoot Tip ▲ │ ┌─────────────┴─────────────┐ │ │ Apical Meristem Intercalary Meristem │ │ ▼ ▼ Growing At base of tip of shoot leaf or internode │ ...

Jul 3 08:56
0
Q: Interpret Custom Language

QOO-OOKALANInterpret Custom Language First Line of Input: An ASCII character, which this character in the language will increase counter by 1 Second Line of Input: An ASCII character, which this character in the language will print a character to output with ASCII code of counter mod 127, and sets counter t...

 

  The Garbage Disposal

Trash, garbage, and other miscellaneous cruft for Programming ...
Jul 7 11:02
0
Q: Why do most languages have a complete operator precedence?

mousetailC has a famously confusing operator precedence order. . It is divided into 15 levels and within the levels there is a clearly defined associativity. Post programmers don't fully remember the exact precedence rules when writing code citation needed, so to aid understandably, style guides usually r...

Jul 6 17:36
0
Q: How to implement a type system suitable for bidirectional type-checking?

Hydroper ResidentContinuing from the question How does bidirectional typechecking for higher-ranked polymorphism work? I'm very used to build type systems in an immediate way, where types are usually nominal and structural ones just interned (although I won't intern at all anymore due to factors like doc. comment...

Jul 2 20:26
0
Q: What algorithms/approaches are known for type inference with subtyping (i.e. semiunification) of non-Turing-complete languages?

David DurschlagWhat are some options for integrating subtyping with Damas-Hindley-Milner inference? gets into this tangentially at the end of Jon Purdy's post ("Placing various restrictions on recursion (acyclicity)"). If not specific algorithms, general approaches would be appreciated. I am guessing having onl...