176 karma · joined April 21, 2015
The "writeText" function produces a derivation (basically an atomic build recipe) that produces that file. The crux of nix is that you make deterministic derivations, and then you can always refer to the results of a derivation from the hash of the derivation and its inputs.
What nix adds is glue logic to chain these derivations together in a way that preserves reproducibility of the individual imperative, but deterministic, components.
Unless you are using something like recursive-nix, you can completely evaluate the nix expression without building any of the derivations.
We covered data structures & algorithms, concurrency, schedulers and virtual memory but it wasn't very math heavy. We have one full semester on software dev cycle and one for UI and mobile app development. Our final project was a group project to assess applying software dev cycle in a team. As far as I'm aware the CS department has a sizable HCI group.
I remember in first year with Python they taught the students to parse integers with `eval`.
And now I have unlocked middle school memories of staying up all night, alternating between lying down from exhaustion to forcing myself to sit and write a few words each round for my English essays that day.
When I played piano there was a point where I could play a piece without thought but couldn't parse the sheet music or know what my fingers were doing anymore.
type Lazy<A> = () => A;
const lazy = <A,>(f: Lazy<A>) => {
let thunk: Lazy<A> = () => { throw null; }
thunk = () => {
const y = f();
thunk = () => y
return y;
};
return thunk;
};
const tap = <A,B>(f: Lazy<(a: Lazy<A>) => Lazy<B>>, a: Lazy<A>): Lazy<B> =>
lazy(() => f()(a)());
const ap = (f: any, a: any): any => tap<any,any>(f, a);
const y = <A,>(f : (a: Lazy<A>) => Lazy<A>): Lazy<A> => ap(((x: any) => ap(ap(f, x), x)),((x: any) => ap(ap(f,x),x)));
type Cat = {
name: string,
friend: Cat,
prefersDryFood: boolean,
foodPerWeek: number
};
export const cat = y<Cat>(self => lazy(() => ({
name: "lol",
friend: self(),
prefersDryFood: false,
foodPerWeek: 4,
})))();
Breaks typescript though. Also, the laziness won't work here.2. I guess the major semantic difference is that in one, you define a family of PERs for terms in a given type, giving each type separate notion of equality. In the other you define equality over all terms and types are just a predicates on terms. I honestly am not well versed enough in logic to understand what it means in that sense.
If you want a more expressive logic, use a language with dependant types. Although I wish to see more powerful type systems become more mainstream, I don't expect every language to aim for that.
EDIT: It's been redirecting to reddit.com since at least 2021
Tooling around it great (it is installed with a rustup fork called elan).
As far as performance, it uses a particular version of ref-counting that allows mutation of unique references based on run-time tracking rather than compile time. If you accidentally keep a reference to an array and modify it, then you end up copying it rather than just mutating it.
Also a reminder that I should read articles before commenting.