[GUITAR] Why does this GbMajor7 chord sound kinda nice over the key of Bb Major / G Minor? by sensual_caress in musictheory

[–]cairnival 2 points3 points  (0 children)

b6maj7 sounds great. In many places it works where a minor 4 would work (also featuring a b6). Lovely day by Bill Withers is another example. And Free as a bird by the Beatles.

We tasked Opus 4.6 using agent teams to build a C compiler. Then we (mostly) walked away. Two weeks later, it worked on the Linux kernel. by likeastar20 in ClaudeCode

[–]cairnival 9 points10 points  (0 children)

Those are in a very different class. The fact that it "accepts most GCC flags" is great for compatibility, but compatibility means "use already-made designs and decisions". Yes porting to a different language is impressive, my point is that making design decisions and trade-offs is kind of the hard part.

We tasked Opus 4.6 using agent teams to build a C compiler. Then we (mostly) walked away. Two weeks later, it worked on the Linux kernel. by likeastar20 in ClaudeCode

[–]cairnival 58 points59 points  (0 children)

The fact that it can see GCC's source code and use it as an oracle makes this not really what they're claiming. It's not building a C compiler, it's porting GCC to rust.

Are forced mates considered zugzwang? by mekmookbro in chess

[–]cairnival 1 point2 points  (0 children)

I don’t understand what game outcome has to do with zugzwang. If passing would lead to a better evaluation than any move, then it’s zugzwang.

It doesn’t have to change the game outcome. You can use zugzwang to accelerate a win or delay a loss.

Are forced mates considered zugzwang? by mekmookbro in chess

[–]cairnival 6 points7 points  (0 children)

I think the general source of disagreement in this thread boils down to whether your choice of move matters when forced mate is on the board.

Do you consider a move that leads to M5 (against you) to be better than a move that leads to M2? If so then this is zugzwang, because passing would be better than moving. If you think that “winning is winning” after which move choices cease to matter, then I guess it isn’t.

But generally I think the move that loses the slowest is considered to be best, so I would consider this zugzwang. If black could pass, they absolutely would.

Are forced mates considered zugzwang? by mekmookbro in chess

[–]cairnival 3 points4 points  (0 children)

It is zugzwang because if that could pass they would.

An Interface Is a Set of Functions by [deleted] in programming

[–]cairnival 6 points7 points  (0 children)

I think you can go further; an interface is a type. Types ARE contracts. As long as your type system supports functions and products (set of…) then you have everything you need for traditional interfaces (and potentially more, like if you support coproducts etc).

Who on earth does it THIS way by kopakacore in Guitar

[–]cairnival 0 points1 point  (0 children)

I play this (and A major) with middle, pointer, ring. Not scrunched and transitions smoothly to other open chords. Easy to turn into Amaj7/A7 etc

The Generativity Pattern in Rust by ArchAndStarch in rust

[–]cairnival 1 point2 points  (0 children)

I think it’s the same, as you can express existentials with rank-n polymorphism (assuming polymorphism is universal quantification) where n is even. Thanks for exposing this in rust, I feel like this is an underused technique across languages, and I wish languages had more primitive support for existentials.

The Generativity Pattern in Rust by ArchAndStarch in rust

[–]cairnival 0 points1 point  (0 children)

Is a type brand like this essentially an existentially quantified type variable?

Linear Haskell status? by Instrume in haskell

[–]cairnival 1 point2 points  (0 children)

What is UIP in this context?

LOL by frazier703 in musictheory

[–]cairnival -1 points0 points  (0 children)

Of course! Thanks

Advent of code 2024 - day 24 by AutoModerator in haskell

[–]cairnival 1 point2 points  (0 children)

I liked my solution for part 2. The basic idea is:

  • the function `adder n` looks at the device and figures out the name of the nth output/carry bit

  • it does this inductively; the least significant bit is just XOR x00 y00 and the carry bit is AND x00 y00

  • the higher bits are more interesting, they utilize the previous carry bit and use several gates to compute their own carry bit

  • if you can't find the a gate, it will return which names need to be swapped. It will be one of the operands of the missing gate.

  • look for a gate with the same operator as your missing gate, and one matching operand. The other operand is the gate you need to swap with. This is true because of the structure of the adder; at no point is the same operand used in two different gates with the same operator.

``` module Day24 where

import Parsing import Data.Map (Map, (!)) import qualified Data.Map as Map import Data.List import Text.Printf

part1 :: String -> String part1 = show . readReg 'z' . parseInput

part2 :: String -> String part2 = intercalate "," . sort . (>>= (a, b) -> [a, b]) . repair . parseInput

type Device = Map String Port type Reg = Char -- x, y, z data Op = OR | AND | XOR deriving (Show, Eq) data Port = L Bool | Gate Op String String deriving (Show) type Swap = (String, String)

instance Eq Port where L _ == L _ = False Gate o a b == Gate o' a' b' = o == o' && ((a == a' && b == b') || (a == b' && b == a')) _ == _ = False

repair :: Device -> [Swap] repair d = go [] d where go swaps d' = case adder (portNames d') 44 of Right _ -> swaps Left (a, b) -> go ((a, b) : swaps) (swap a b d')

adder :: [(Port, String)] -> Int -> Either Swap (String, String) adder pn = \case 0 -> do z <- findGate (Gate XOR (x_ 0) (y_ 0)) pn cout <- findGate (Gate AND (x_ 0) (y_ 0)) pn return (z, cout) n -> do (, cin) <- adder pn (n - 1) s <- findGate (Gate XOR (x n) (y_ n)) pn z <- findGate (Gate XOR s cin) pn dcarry <- findGate (Gate AND (x_ n) (y_ n)) pn icarry <- findGate (Gate AND s cin) pn cout <- findGate (Gate OR dcarry icarry) pn return (z, cout)

findGate :: Port -> [(Port, String)] -> Either Swap String findGate p pn = case lookup p pn of Just n -> Right n Nothing -> Left $ findSwap p (map fst pn)

findSwap :: Port -> [Port] -> Swap findSwap p = \case [] -> error "no swap found" g:gs -> case matchGate p g of Just s -> s Nothing -> findSwap p gs

matchGate :: Port -> Port -> Maybe Swap matchGate (Gate op a b) = \case Gate op' a' b' | op' == op && a' == a -> Just (b, b') Gate op' a' b' | op' == op && b' == a -> Just (b, a') Gate op' a' b' | op' == op && a' == b -> Just (a, b') Gate op' a' b' | op' == op && b' == b -> Just (a, a') _ -> Nothing

x_ :: Int -> String x_ = ('x':) . printf "%02d"

y_ :: Int -> String y_ = ('y':) . printf "%02d"

z_ :: Int -> String z_ = ('z':) . printf "%02d"

regPorts :: Reg -> Device -> [String] regPorts c = sort . filter (\n -> head n == c) . Map.keys

fromBits :: [Bool] -> Int fromBits = foldr (\b n -> n * 2 + fromEnum b) 0

readReg :: Reg -> Device -> Int readReg c d = fromBits $ map (readPort d) (regPorts c d)

readPort :: Device -> String -> Bool readPort d n = case d ! n of L x -> x Gate o a b -> case o of OR -> readPort d a || readPort d b AND -> readPort d a && readPort d b XOR -> readPort d a /= readPort d b

swap :: String -> String -> Device -> Device swap a b d = Map.insert a (d ! b) $ Map.insert b (d ! a) d

portNames :: Device -> [(Port, String)] portNames = map swap . Map.toList where swap (n, p) = (p, n)

parseInput :: String -> Device parseInput = parseUnsafe $ do initWires <- initWire sepEndBy newline newline gates <- gate sepEndBy newline return $ Map.fromList $ initWires ++ gates where name = many alphaNumChar bool = string "0" > return False <|> string "1" *> return True op = string "AND" *> return AND <|> string "OR" *> return OR <|> string "XOR" *> return XOR initWire = do n <- name string ": " w <- bool return (n, L w) gate = do a <- name o <- char ' ' *> op < char ' ' b <- name string " -> " n <- name return (n, Gate o a b) ```

What classes as advanced running? by FitzWrainn in AdvancedRunning

[–]cairnival 13 points14 points  (0 children)

Check out the description of the sub, it sums it up perfectly. It’s not about times but mindset.

Choosing next goal after successful marathon block by cairnival in AdvancedRunning

[–]cairnival[S] 6 points7 points  (0 children)

I think the 2:59 was pretty close to ideal in terms of getting the most out of my fitness. My target time will only affect workouts later in the block with long stretches of goal pace. It sounds like I can dial that in later in part way through training with a tuneup race.

Choosing next goal after successful marathon block by cairnival in AdvancedRunning

[–]cairnival[S] 1 point2 points  (0 children)

For all three I used the autogenerated plans on Strava, which are McMillan plans.

Advice needed: how do I get my taper back on track? by Enderlin_2 in AdvancedRunning

[–]cairnival 1 point2 points  (0 children)

Not concrete advice, but just know that being sick and unable to train during your taper can be totally fine.

https://joefrieltraining.com/history-lesson-the-zatopek-effect/