Map [1]
| Operation | Time Complexity |
|---|---|
| Access | O(log n) |
| Search | O(log n) |
| Insertion | O(n) for <= 32 elements, O(log n) for > 32 elements [2] |
| Deletion | O(n) for <= 32 elements, O(log n) for > 32 elements |
| import libtorrent as lt | |
| # usage: | |
| # sudo apt install python3-libtorrent | |
| # wget https://thenftbay.org/billion-dollar-nft-torrent.torrent | |
| # python3 t.py | |
| info = lt.torrent_info("billion-dollar-nft-torrent.torrent") | |
| print("Number of pieces: ", info.num_pieces()) | |
| print("dumping piece hashes:") |
| Here's a quick dockerfile: | |
| ----------------8<-------------[ cut here ]------------------ | |
| FROM debian:latest | |
| RUN apt-get update && apt-get install -y nodejs npm | |
| ----------------8<-------------[ cut here ]------------------ | |
| save that as Dockerfile and do: docker build -t node-builder . | |
| #!/usr/bin/python3 | |
| from sseclient import SSEClient | |
| import json | |
| from math import sqrt | |
| import winsound # NOTE: Windows only | |
| from datetime import datetime, timezone, timedelta | |
| ''' | |
| Version 2.1 (2023-07-07): A small script that alerts the user of lightning if it strikes within 16 km (10 miles) of your home position in the Nordics. | |
| Based on lightning observations broadcast as SSE from The Norwegian Meteorological Institute, https://www.met.no/. |
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
| #!/bin/bash | |
| while :; do | |
| verf=$(cat /dev/urandom | tr -dc '0-9' | fold -w 8 | head -n 1) | |
| pin=$(cat /dev/urandom | tr -dc '0-9' | fold -w 5 | head -n 1) | |
| ip=$(printf "%d.%d.%d.%d\n" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))") | |
| {-# LANGUAGE GADTSyntax #-} | |
| {-# LANGUAGE DeriveFoldable #-} | |
| module Tree where | |
| import Control.Monad | |
| import Data.Maybe | |
| import Data.Foldable | |
| data T a = L | N (T a) a (T a) deriving (Show, Foldable) |
def hash(a: A): Int makes me sad. What about hashing to 64 bits or SL2 Fp?def MapHash[A, B: Hash]: Hash[Map[A, B]] is a bit odd. Why not A: Hash?reflexiveLaw + symmetryLaw + transitivityLaw is too weak for "equality". This defines a general equivalence relationship only.val AnyEqual: Equal[Any] is worrisome, considering all the resolution bugs!val DoubleEqual: Equal[Double] should be implemented using java.lang.Double.doubleToRawLongBits.trait Ord[-A] extends Equal[A]](https://github.com/zio/zi| -- Many faces of isOrderedTree | |
| -- Code to the talk (extended version) | |
| {-# LANGUAGE DeriveFoldable #-} | |
| module Tree where | |
| import Control.Monad | |
| import Data.Maybe | |
| import Data.Foldable |
See also List of materials about Software Design in Haskell
| Junior | Middle | Senior | Architect | |
|---|---|---|---|---|
| Haskell level | Basic Haskell | Intermediate Haskell | Advanced Haskell | Language-agnostic |
| Haskell knowledge scope | Learn you a Haskell | Get programming with Haskell | Haskell in Depth | Knows several languages from different categories |
| Get programming with Haskell | Haskell in Depth | Functional Design and Architecture | ||
| Soar with Haskell | [Soar |