(the 'grand unified' part is halfway jesting, but this is a nice generalization of the main requirements of programs.)
A program (software program), has at most two responsibilities: (1) State-management, and (2) Effects-propagation.
use memoffset::offset_of; | |
use simple_logger::SimpleLogger; | |
use winit::{ | |
event::{ | |
Event, KeyboardInput, WindowEvent, | |
ElementState, StartCause, VirtualKeyCode, | |
DeviceEvent, |
const itemQualityFunctionIndex = { | |
"Aged Brie": function(item) { | |
item.quality++; | |
return item | |
}, | |
"Backstage passes": function (item) { | |
if (item.sellIn <= 10 && item.sellIn > 5) { | |
item.quality += 2; |
use memoffset::offset_of; | |
use simple_logger::SimpleLogger; | |
use winit::{ | |
event::{ | |
Event, KeyboardInput, WindowEvent, | |
ElementState, StartCause, VirtualKeyCode | |
}, |
use winit::{ | |
event::{Event, KeyboardInput, WindowEvent}, | |
event_loop::{ControlFlow, EventLoop}, | |
window::WindowBuilder, | |
window::Window, | |
}; | |
use simple_logger::SimpleLogger; |
// Mergesort implementation in Rust translated from the Python example at | |
// https://www.interviewbit.com/tutorial/merge-sort-algorithm/ | |
fn main () { | |
println!(".......Mergesort"); | |
let unsorted : [i32; 10] = [949, 8232, 158, 369, 1, 43, 949, 381112, 4184, 12]; |
Every conversation, argument of import, runs into the same confusions of meaning. We all know how the meanings of words can shift with context. We all know how one man's meaning of a given word can differ substantially from another's. I'm not contributing anything new by commenting on this.
I have some elaborations on this idea that I believe can be helpful. These are inspired by, or taken directly from Gilles Deleuze's work in a book called "What is Philosophy."
# credit https://www.programwitherik.com/how-to-create-a-linked-list-and-stack-in-javascript-2/ for the LinkedList implementation, | |
# I just did the recursive remove_duplicates function. | |
c = console.log.bind console | |
LinkedList = -> | |
@head = null | |
LinkedList.prototype.push = (val) -> |