Skip to content

Instantly share code, notes, and snippets.

@jackrr
jackrr / distinct-p.clj
Created February 5, 2022 20:34
Lazily remove duplicate members of list, by predicate "hashing" function on members
(defn distinct-p
([pred coll]
(distinct-p pred coll #{}))
([pred coll seen]
(if (empty? coll)
'()
(lazy-seq
(let [next (first coll)
key (pred next)
is-dup (contains? seen key)
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
<!doctype html>
<html>
<head>
<title>02.3 Google Fonts Louise's Web Site</title>
</head>
<body>
<h1>Welcome to Louise's web site!</h1>
<p><img src="http://dev.robkovacs.com/louise.jpg"></p>
<!DOCTYPE html>
<html>
<head>
<title>03.1 ID Practice Carlton's Food</title>
</head>
<body>
<h1>What can Carlton eat?</h1>
<img src="https://pmcvariety.files.wordpress.com/2015/08/alfonso-ribeiro-fresh-prince-of-bel-air.jpg?w=670&h=377&crop=1">
<ul>
<li>Steak</li>
@jackrr
jackrr / index.html
Last active October 14, 2017 18:11
Exported from Popcode. Click to import: https://popcode.org/?gist=05851ef2f694b1a714a144f199cd3fba
<!DOCTYPE html>
<html>
<head>
<title>IDs Practice</title>
</head>
<body>
<p id="one">one</p>
<p id=" ">two</p>
<p id=" ">three</p>
<p id=" ">four</p>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div id="myDiv"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div id="pizza"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div id="pizza"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>For Loop part 2</title>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>For Loop do now</title>
</head>
<body>
<h2>Can you make me show numbers from 0 - 10?</h2>
<button>click here</button>
</body>
</html>