Skip to content

Instantly share code, notes, and snippets.

type TrieNode = {
children: Record<string, TrieNode>
isEnd: boolean
}
class Trie {
root: TrieNode = { children: {}, isEnd: false }
insert(word: string) {
let node = this.root
defmodule CsvReader do
@demo """
1,18,tim
2,35,jon
5,23,tom
"""
def load(csv, type \\ :tuple) when is_binary(csv) and type in [:tuple, :map, :keyword_list] do
csv
|> parse_csv(type)
end
@nesokad
nesokad / fop.go
Last active August 23, 2023 03:57
Functional Options pettern
package server
import (
"errors"
"github.com/google/uuid"
)
// ServerConfiguration defines the configuration function signature.
type ServerConfiguration func(s *Server) error