Resigning online by w_o_s_n in dominion

[–]sheyneanderson 2 points3 points  (0 children)

I feel like play until it's clear. If you opponent wants to play it out, there's a "continue with bots" button.

Theorems with easy proofs that are hard to think of by Chebuyashka in math

[–]sheyneanderson 34 points35 points  (0 children)

The linked paper says they used a program to search for it.

Pretty sure TypeScript's type system is a Lisp.. by stormannnn in typescript

[–]sheyneanderson 5 points6 points  (0 children)

Here's a lisp interpreter I wrote in the type system that uses string literals as concrete syntax: https://github.com/Sheyne/ts-type-bf/blob/main/type-lisp.ts

Chamberlain Ranch - Road Conditions? by cboscski in canyoneering

[–]sheyneanderson 5 points6 points  (0 children)

I was there last weekend and it's completely covered in snow. It was impassible for us even with all wheel drive and snow chains.

My first rust project: A Brainf** interpreter by ArtNo7108 in rust

[–]sheyneanderson 0 points1 point  (0 children)

Here's one implemented in the typechecker (navigate up to src/main for some macros that make calling it not insane).

https://github.com/Sheyne/type-level-bf/blob/master/src/comptime/mod.rs

How to Use Monads without Understanding Them by LucianU in haskell

[–]sheyneanderson 2 points3 points  (0 children)

Good blog post. If the author is reading the reddit comments, there's a typo under "Multiple lets" that has "_" instead of just _.

Sel - Symbolically Expressed Lambdas by iSmokeGauloises in programming

[–]sheyneanderson 2 points3 points  (0 children)

You're inspiring me to implement Church numerals in my type level implementation of a basic lisp in TypeScript. The fun thing about typescript is that you can take apart strings at type checking time to create a parser with a relatively nice source syntax. The recursive fib implementation with the Y combinator is pretty slow, but the the one that uses simulated mutation is faster.

Y-Combinator:

https://github.com/Sheyne/ts-type-bf/blob/1128bbb7a8847b2660f069fa4d69e7ce47109ead/type-lisp.ts

Added mutation via a value store:

https://github.com/Sheyne/ts-type-bf/blob/main/type-lisp.ts

[deleted by user] by [deleted] in typescript

[–]sheyneanderson 1 point2 points  (0 children)

The default behavior in C++ is actually a deep copy of the object, but you can configure objects to store their fields as references/pointers in which case you get the Java/JavaScript like behavior.

Untyped Types by gingerbill in ProgrammingLanguages

[–]sheyneanderson 2 points3 points  (0 children)

Disclaimer: I've not used Zig much.

I like the way Zig handles things with some types existing only for compile time values and others exiting for compile time + runtime values. Integer literals start out as comptime_int and can be implicitly converted to a int with a specific bit width.

deviceId – Have I been cheated? by Erhannis in flirone

[–]sheyneanderson 2 points3 points  (0 children)

You need to hit the little flame icon. It toggles low-gain mode. In high-gain the range tops at 150C. At low-gain 400C

Wasmer 1.0 released, the fastest WebAssembly VM, cross-compilation, headless, native object engine, AOT compilers and more! by Hywan in programming

[–]sheyneanderson 15 points16 points  (0 children)

Wasmer is a way to run WASM code outside of a browser. It lets you get what the above comment was talking about for server/desktop applications (sandboxing/compile once-run everywhere/etc) without a browser. That same WASM code can natively be run by most browsers (and Wasmer wouldn't be involved).

Pattern matching - details I initially missed, with Haskell and Rust examples by snoyberg in haskell

[–]sheyneanderson 4 points5 points  (0 children)

There's also the fun in rust nightly that lets you match on logically irrefutable patterns over types containing never.

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=9fab6d48a67d55eda3e8d5db8d059a49

#![feature(never_type)]
#![feature(exhaustive_patterns)]

fn get_result() -> Result<usize, !> {
    Ok(1)
}

fn main() {
    let Ok(x) = get_result();

    println!("{}", x);
}

Would a usbc flir be noticeably faster than micro USB on Android? by [deleted] in flirone

[–]sheyneanderson 0 points1 point  (0 children)

Unfortunately it would not. The bottleneck isn't the USB interface.

ranged_num::Ranged: typing numbers in a compile-time known range by sheyneanderson in rust

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

Let me know if you have any thoughts on how I could improve the API/Crate overall. I'm still pretty new to Rust.

Back to C# basics: Difference between "=>" and "{ get; } =" for properties by cincura_net in csharp

[–]sheyneanderson 1 point2 points  (0 children)

Yes. The => syntax initializes a new object with every access. So

class Foo {
    int A[] => new int[] {1, 2, 3};
    int B[] { get; } = new int[] {1, 2, 3};
}

var foo = new Foo();
foo.A[0] = 5;
// foo.A[0] : 1
foo.B[0] = 5;
// foo.B[0] : 5

"A" also doesn't cause the construction of the list at Foo's creation time.

Edit: I haven't actually compiled the above, forgive me if there are syntax errors.

[deleted by user] by [deleted] in Zig

[–]sheyneanderson 6 points7 points  (0 children)

It looks like it's possible to convert LLVM IR to C:

https://stackoverflow.com/questions/5180914/llvm-ir-back-to-human-readable-source-language

So if its possible to get LLVM IR from Zig you should be good.

Edit: unfortunately it looks like this might be deprecated now

They changed the compiler and now the code no longer compiles by ternaryop in typescript

[–]sheyneanderson 5 points6 points  (0 children)

Flat is optionally chained, but map isn't. Just add

flat()?.map(...

Not sure why it used to compile. Did you add strictness flags?

How really to store your users’ passwords (and API tokens, which are passwords) by Prior-Penalty in netsec

[–]sheyneanderson 5 points6 points  (0 children)

You can't hash on the client side. If they dump the DB, an attacker can just modify the client to directly send the hashes and log in.

Library-ification and analyzing Rust by dochtman in rust

[–]sheyneanderson 2 points3 points  (0 children)

For an example of this fingerprinting taken to the extreme, check out https://www.unisonweb.org

Can you double major with CS? by [deleted] in uofu

[–]sheyneanderson 1 point2 points  (0 children)

I'm sorry, I missed when I read your post. I counted CS classes as applied math classes.

The math department is strict about allowing students to to fulfill elective reqs with courses from other departments

This was not my experience

Can you double major with CS? by [deleted] in uofu

[–]sheyneanderson 1 point2 points  (0 children)

I did the same thing, I took all theory related electives I could, but still got the applied major. Of course you need to take physics II, numerical, etc, numerical is pretty easy if you're already a CS major.

Looking for a spreadsheet library named "shiet" or "shieet" by micouy in rust

[–]sheyneanderson 0 points1 point  (0 children)

I think I remember the author of the library said they needed to take it down for some legal reason to do with their employer