Entropy can be understood as the minimum amount of data needed to be transmitted
in order to communicate a piece of information. Concretely, this is the average
number of bits needed to encode a message. For example, imagine a spaceship
sends a status code every minute to indicate if it has found any alien
civilization. The code is any letter from the English alphabet, with
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import cgi | |
import sqlite3 | |
# Create or connect to the SQLite database | |
conn = sqlite3.connect('gb.db') | |
cursor = conn.cursor() | |
# Create a table to store guestbook entries if it doesn't exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ksh | |
# Function to create the SQLite database and table if they don't exist | |
create_database() { | |
if [ ! -f guestbook.db ]; then | |
sqlite3 guestbook.db 'CREATE TABLE entries (id INTEGER PRIMARY KEY AUTOINCREMENT, message TEXT)' | |
fi | |
} | |
# Function to fetch and display guestbook entries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE t1 (x INTEGER); | |
CREATE TABLE t2 (x INTEGER); | |
INSERT INTO t1 VALUES (1), (1), (2), (3); | |
INSERT INTO t2 VALUES (2), (1), (3), (2); | |
-- If t1=t2 (meaning they are the same bag/multiset), then the following should return nothing. | |
-- Sanity check: do they contain the same *set* of elements (ignoring duplicates)? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use egg::*; | |
/// A [`Condition`] that checks if a pattern is already in the egraph. | |
pub struct ConditionExists<L> { | |
p: Pattern<L>, | |
} | |
impl<L: Language> ConditionExists<L> { | |
/// Create a new [`ConditionExists`] condition given a pattern. | |
pub fn new(p: Pattern<L>) -> Self { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
âPNG | |