williamcotton.com

A Burrito Is a Monad

May 18th, 2024

A Burrito is a monad...

type Meat = Chicken | Beef | Pork | Fish | Veggie

type Ingredient = 
    | Cheese | Rice | Beans | Salsa | Guacamole | SourCream | Lettuce
    | Tomato | Onion | Cilantro | PicoDeGallo

type Burrito = Meat option * Ingredient list

let (>>=) burrito f =
    match burrito with
    | Some meat, ingredients -> f (Some meat, ingredients)
    | None, _ -> None, []

let returnBurrito (meat, ingredients) = meat, ingredients

let tortilla = returnBurrito (Some Veggie, [])

let addMeat meat (m, ingredients) = Some meat, ingredients

let addIngredient ingredient (meat, ingredients) =
    meat, ingredient :: ingredients

let addMissionBurritoIngredients (meat, ingredients) =
    meat, Cheese :: Rice :: Beans :: ingredients

let holdThe ingredient (meat, ingredients) =
    meat, List.filter (fun i -> i <> ingredient) ingredients

let burrito = 
    tortilla
    >>= addMeat Chicken
    >>= addMissionBurritoIngredients
    >>= holdThe Cheese
    >>= addIngredient PicoDeGallo
    >>= addIngredient Salsa
    >>= addIngredient Guacamole
    >>= addIngredient SourCream

printfn "%A" burrito

It's got Some Chicken.

I'll see myself out...

Writing Web Applications with LLMs

April 20th, 2023

Using large-language models like OpenAI's GPT family for writing software has been one of the first successful uses for these tools. GitHub's Copilot can successfully implement a large number of software related tasks, from writing code, to tests or even documentation and has become somewhat of an indispensable tool to a large number of software engineers.

While Copilot and other tools that aid in writing code are here for the foreseeable future there are methods for using large-language models that move up the ladder of abstraction and allow for text instructions to update a user interface with interactive functionality.

An example of such an approach is seen in the browser-builder augmentation from the transynthetical-engine.

Here's a brief workflow of building a circle drawing application.

      כִּ֛י יֵשׁ־דְּבָרִ֥ים הַרְבֵּ֖ה מַרְבִּ֣ים הָ֑בֶל מַה־יֹּתֵ֖ר לָאָדָֽם׃

March 21st, 2023

In this age of information overload, it can be easy to lose sight of what truly matters: our connection to God, our love for one another, and our pursuit of wisdom.

The temptations of social media, news, and public opinion are ever-present in our daily lives. We must be cautious of the impact these distractions can have on our spiritual well-being. While we may be drawn to these platforms for connection and knowledge, we must remember that our true source of guidance and strength comes from God.

Proverbs 4:23 advises us, "Above all else, guard your heart, for everything you do flows from it." Let us guard our hearts against the distractions of social media and the news media, which can lead us away from the path of righteousness.

As it is written in Ecclesiastes 1:18, "For with much wisdom comes much sorrow; the more knowledge, the more grief." We must remember that an endless pursuit of information can distract us from the wisdom and guidance that God provides.

ChatGPT and the Analytic-Synthetic Distinction

February 8th, 2023

Although primarily relegated to the dustbin of philosophy, the distinction between two kinds of propositions, analytic and synthetic, is useful once again in the context of interacting with a large language model like ChatGPT. Kantians, rejoice!

With complete disregard to the formalisms of analytic philosophy:

An analytic proposition is something like "All bachelors are unmarried." This is true by definition. We don't need to go looking for any other facts in order to verify this assertion.

In contrast, a synthetic proposition is something like "It is raining outside." Here the truthfulness of the assertion is contingent on outside facts. Literally. You have to look outside to see if it is raining or not.

Authentically Human in a World of ChatGPT

February 7th, 2023

As outlined in The Tyranny of the Anonymous, anonymity on the internet is clearly beneficial in some cases and technically here to stay, but there are plenty of reasons for optional forums that do not allow anonymous participation

A rapidly accelerating use of anonymity is to hide the fact that a participant is not even human, let alone a troll or state-sponsored actor. Large-language models such as GPT will increasingly be used in ways to appear as though something published to a website was from a human author and for reasons that are too unpredictable to enumerate. It seems wise to offer a solution.

Relying on private companies such as Meta or Amazon for identity verification is unwise for a number of reasons, but most importantly that private companies are in the business of providing services to their customers. Just look how easy it is for someone to engage in social engineering when faced with a person trained in part to keep the customer happy! Can you imagine the "crying baby trick" working with the an employee of the DMV? From my experience the DMV is not in the business of keeping anyone happy and has plenty of experience and protocols in place to limit fraudulent identification.

So how do we go about such state-level identity verification?

Pepsi Advertisement Recontextualized as Social Media

March 31st, 2019

Perhaps you remember the moment, perhaps you don't. Maybe you were outraged, maybe you were on #TeamKendall, maybe you don't care too much about it either way. Kendall Jenner was featured in a Pepsi advertisement, that for at least for a few days became a source of popular controversy that propagated throughout the digital media ecosystem.

The video portrayed a number of creative young individuals who join an unknown cause expressed as a joyous public protest. This includes Kendall Jenner, who leaves a modeling photo shoot to join the mass, eventually coming face-to-face with a line of policemen. She then gives one of the officers a can of Pepsi, everyone smiles and the video cuts to the corporate logo.

As Bernice King, daughter of Martin Luther King, Jr., stated on Twitter,

If only Daddy would have known about the power of #Pepsi.

The Problem of Censorship

February 18th, 2019

It is a moot point wether or not Facebook, Twitter or Google are engaged in censorship when they remove content from their platforms, as this discussion is mainly about semantics. While it is true that private companies have the legal right to decide on their own editorial policies it becomes problematic when those private companies hold an incredibly large sway over society. As of early 2019 Facebook has over 2.3 billion active monthly users. There is nary a working journalist or politician without a Twitter account. Their policies on what information to promote or disallow has a profound effect on societies across the globe.

As Thomas Macaulay wrote of British Parliament in 1828,

The gallery in which the reporters sit has become a fourth estate of the realm. The publication of the debates, a practice which seemed to the most liberal statesmen of the old school full of danger to the great safeguards of public liberty, is now regarded by many persons as a safeguard tantamount, and more than tantamount, to all the rest together.

Representative democracies rely on the relationship between journalism and government. The problem we are facing is that our contemporary means of publishing information to the voting public is primarily through privately controlled and for-profit corporations.

The Tyranny of the Anonymous

January 16th, 2019

From the Federalist Papers to contemporary whistleblowers, there is plenty of evidence of the benefits of an anonymous check on power. There is no question that the anonymity of the masses is the enemy of the traditional despot. Throughout history it has been deemed advantageous by authoritarian leaders to controls the means of communication and to punish those that question their powers.

Cryptography and the internet have forever closed the door on this kind of censorship. While individual websites like Facebook or YouTube can indeed monitor and police the content that is published on their platforms, there will always be alternative methods of publication that are impossible to silence. Between tools and technologies like Signal, Telegram, Tor, Bitcoin, or BitTorrent, there are many ways for people to avoid the prying eyes of nefarious controlling bodies.

While there are benefits to being anonymous, there are very good reasons why people would want to use a communication platform that requires people to use their real names and identities. People have a need to interact with their friends, family, neighbors and other people whose identities they already know. The vast majority of our daily interactions are face-to-face.

Accountability and transparency, foundational elements of our society, are somewhat at odds with anonymity. Commercial and financial transactions are built on various types of infrastructure to facilitate and enforce accountability. Facebook's marketplace works best with a verified identity for the same fundamental reason that a pawn shop requires a state-issued photo ID. There is also a need for accountability for the content published on social media platforms. Physical threats and other forms of unprotected speech will always need to be policed.