I hereby claim:
- I am lispyclouds on github.
- I am rahulde (https://keybase.io/rahulde) on keybase.
- I have a public key whose fingerprint is AC83 35A1 FC06 3D39 BB71 DBD7 D695 9EE4 51EA 8C21
To claim this, I am signing this object:
| import json | |
| import sqlite3 | |
| import sys | |
| from bcoding import bencode, bdecode | |
| def read(): | |
| return dict(bdecode(sys.stdin.buffer)) |
| import scala.io.StdIn | |
| // Result[+T] is a Monoid with bind as the join fn | |
| sealed trait Result[+T] { | |
| // makes this a Functor | |
| def map[U](f: T => U): Result[U] | |
| // bind hence a Monad | |
| def flatMap[U](f: T => Result[U]): Result[U] | |
| } |
| ; A simple demo of monadic composition of side effects | |
| ; Program to take 3 nubers as input and print their sum. | |
| (defn read-and-add! | |
| [prev] | |
| (print "Enter a number: ") | |
| (+ prev (do (flush) | |
| (Integer/parseInt (read-line))))) | |
| (defn bind |
| import java.util.Scanner | |
| sealed class Maybe<out T> | |
| data class Just<T>(val value: T) : Maybe<T>() | |
| object None : Maybe<Nothing>() { | |
| override fun toString() = "None" | |
| } |
| from functools import reduce | |
| class Maybe(object): | |
| def __str__(self): | |
| return "Maybe" | |
| class Something(Maybe): | |
| def __init__(self, value): |
| ; to define the loop macro | |
| (defmacro loop_ [& body] `(while true ~@body)) | |
| ; Create the REPL! | |
| (-> (read) (eval) (println) (loop_)) |
| #!/usr/bin/env python3 | |
| import sys | |
| limit = 6 | |
| mod = 10 ** limit | |
| def mat_mul(m1, m2): |
| ;; Clojure translation of https://sourceforge.net/p/drjava/git_repo/ci/master/tree/drjava/src/edu/rice/cs/util/ArgumentTokenizer.java | |
| ;; Input: "sh -c \"while sleep 1; do echo \\\"${RANDOM}\\\"; done\"" | |
| ;; Output: ["sh", "-c", "while sleep 1; do echo \"${RANDOM}\"; done"] | |
| (defn shell-tokenize! | |
| [^String command] | |
| (let [[escaped? | |
| current-arg | |
| args | |
| state] (loop [cmd command |
I hereby claim:
To claim this, I am signing this object:
| (ns stocks.core | |
| (:gen-class) | |
| (:require [clj-http.client :as client]) | |
| (:require [cheshire.core :refer :all])) | |
| (def url "http://dev.markitondemand.com/MODApis/Api/v2/Quote/json?symbol=%s") | |
| (defn get-stock-value-of | |
| [symbol] | |
| (let [response (-> ((client/get (format url symbol)) :body) |