I hereby claim:
- I am safehammad on github.
- I am safehammad (https://keybase.io/safehammad) on keybase.
- I have a public key whose fingerprint is 4DDE 1E0F 1F38 9006 79EE 0056 7625 4174 3B9A 415F
To claim this, I am signing this object:
(ns chunking | |
"This is the REPL session a group of us played with at the London Clojure Dojo on | |
1st August 2023 with the aim of understanding chunking and its potential gotchas.") | |
;; Many of Clojure's core functions such as `map`, `filter`, `take` and `drop` produce | |
;; lazy sequences. The elements of a lazy sequence are only evaluated or "realized" as | |
;; needed. Although it appears each element is evaluated one at a time, since Clojure 1.1, | |
;; evaluation is "chunked" such that elements are evaluated 32 at a time, a performance | |
;; optimisation based on the fact that Clojure's immutable data structures are a so-called | |
;; "trie" with 32 children per node. |
;; Explorations on James Bond film titles | |
;; See blog post: | |
;; Full source code: https://github.com/safehammad/bond-title-generator | |
(def titles ["Dr No" "From Russia with Love" "Gold finger" "Thunder ball" "You Only Live Twice" "On Her Majesty’s Secret Service" "Diamonds Are Forever" "Live and Let Die" "The Man with the Golden Gun" "The Spy Who Loved Me" "Moon raker" "For Your Eyes Only" "Octo pussy" "Never Say Never Again" "A View to a Kill" "The Living Day lights" "Licence to Kill" "Golden" "Eye" "Tomorrow Never Dies" "The World is Not Enough" "Die Another Day" "Casino Royale" "Quantum of Solace" "Sky fall" "Spectre" "No Time to Die"]) | |
(def tokenised-words (map str/lower-case (mapcat #(str/split % #" ") titles))) | |
; => ["dr" "no" "from" "russia" "with" "love" "gold" "finger" "thunder" "ball" "you" "only" "live" "twice" "on" "her" "majesty’s" "secret" "service" "diamonds" "are" "forever" "live" "and" "let" "die" "the" "man" "with" "the" "golden" "gun" "the" "spy" "who" "loved" "me" "moon" "raker" "for" "yo |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env python3 | |
def introduction(): | |
print('Welcome to the Python teacher. My job is to teach you how to program.') | |
def learn_print_literal(): | |
""" | |
The 'print' function in Python is used to print words. You only need to tell |
from nltk.corpus import cmudict | |
from nltk.corpus import wordnet | |
def is_multi_pos(word): | |
"""Return True if the given word can be used as both a noun and a verb. | |
With a small tweak, you can find words which can also be used as an adjective, or | |
any combination of the above. | |
""" |
#!/usr/bin/env python3 | |
"""Tennis scorer developed during Python Northwest coding meeting Dec 2012. | |
Given a current score and the winner of the next point, the script | |
will return the next score. | |
Usage: python3 tennis.py <p1_score> <p2_score> <scorer> | |
Output: <p1_score> <p2_score> |
#!/bin/bash | |
# Tennis Score Python Script Tester | |
# | |
# Usage: tennis <python_script> | |
# | |
# Args passed to script: <score_player_1> <score_player_2> <next_point_won_by> | |
# New score expected: <score_player_1> <score_player_2> | |
# | |
# Where <score_player_n> is one of 0, 15, 30, 40, ADV, WIN |