This file contains 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
(defn in? | |
"true if seq contains elm" | |
[seq elm] | |
(boolean (some (fn [e] (= elm e)) seq))) |
This file contains 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 for-loop | |
set list \ | |
"foo" \ | |
"bar" \ | |
"zee" | |
for item in $list | |
echo "item: $item" | |
end | |
end |
This file contains 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
#!/usr/bin/env python | |
from subprocess import Popen, PIPE | |
import operator | |
import os | |
import re | |
import datetime | |
import time | |
from functools import reduce | |
from pathlib import Path |
This file contains 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.core.async :as a]) | |
(def xform (comp (map inc) | |
(filter even?) | |
(dedupe) | |
(flatmap range) | |
(partition-all 3) | |
(partition-by #(< (apply + %) 7)) | |
(flatmap flatten) | |
(random-sample 1.0) |
This file contains 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
;; Programming Languages, Homework 5 | |
#lang racket | |
(provide (all-defined-out)) ;; so we can put tests in a second file | |
;; definition of structures for MUPL programs - Do NOT change | |
(struct var (string) #:transparent) ;; a variable, e.g., (var "foo") | |
(struct int (num) #:transparent) ;; a constant number, e.g., (int 17) | |
(struct add (e1 e2) #:transparent) ;; add two expressions | |
(struct ifgreater (e1 e2 e3 e4) #:transparent) ;; if e1 > e2 then e3 else e4 |
OlderNewer