This file contains hidden or 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
| (require '[clojure.java.io :as io]) | |
| (require 'clojure.set) | |
| (defn lines [] | |
| (let [rdr (io/reader "2017-10-15.txt")] | |
| (line-seq rdr))) | |
| (defn parse-line [line] | |
| (let [parts (clojure.string/split line #";") | |
| [semester title crn |
This file contains hidden or 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
| (require '[clojure.java.io :as io]) | |
| (require 'clojure.set) | |
| (defn lines [] | |
| (let [rdr (io/reader "2017-10-15.txt")] | |
| (line-seq rdr))) | |
| (defn parse-line [line] | |
| (let [parts (clojure.string/split line #";") | |
| [semester title crn |
This file contains hidden or 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
| (require '[clojure.java.io :as io]) | |
| (defn lines [] | |
| (let [rdr (io/reader "2017-10-15.txt") | |
| pattern #"^201709.*CSCI.*"] | |
| (filter #(re-matches pattern %) (line-seq rdr)))) | |
| (defn sort-unique [courses] | |
| (sort (into #{} courses))) |
This file contains hidden or 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
| (require '[clojure.pprint :refer [pprint]]) | |
| (def course {:tests {"quiz 1" {:total 10 | |
| :weight 0.1 | |
| :num-questions 3} | |
| "quiz 2" {:total 5 | |
| :weight 0.1 | |
| :num-questions 2} | |
| "test 1" {:total 100 | |
| :weight 0.4 |
This file contains hidden or 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
| // concurrent version of finding primes | |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "os" | |
| "os/signal" | |
| "sync" |
This file contains hidden or 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
| (require '[clojure.pprint :as pprint]) | |
| ;; Q1. | |
| ;; ========================================= | |
| (def table | |
| [{ | |
| :product "Pencil" | |
| :city "Toronto" | |
| :year 2010 | |
| :sales 2653.00 |
This file contains hidden or 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
| [:section | |
| [:h1 "Mathematical Expressions"] | |
| [:p "We will be doing | |
| machine learning."] | |
| [M " | |
| I don't know how to write this | |
| - Create a simple equation | |
| - Write a loop | |
| - Compile |
This file contains hidden or 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
| .PHONY: all big wide clean | |
| all: big wide | |
| big: big.txt sort-strings.py | |
| python sort-strings.py big.txt | |
| big.txt: make-strings.py | |
| python make-strings.py 100000 100 big.txt |
This file contains hidden or 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
| import random | |
| def merge(list1, list2): | |
| i, j = 0, 0 | |
| list3 = [] | |
| while i < len(list1) and j < len(list2): | |
| if list1[i] <= list2[j]: | |
| list3.append(list1[i]) | |
| i += 1 |
This file contains hidden or 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
| function quicksort(X, i, j) { | |
| if(i < j) { | |
| p = partition(X, i, j) | |
| quicksort(X, i, p-1) | |
| quicksort(X, p+1, j) | |
| } | |
| } | |
| function partition(X, i, j) { | |
| var pivot = X[j]; |
NewerOlder