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 Control.Monad.Trans.State | |
data Cycle = Cycle { brand :: String, id :: Int, price :: Int } deriving Show | |
data Store = Store { cycles :: [Cycle], rentals :: [Rental]} deriving Show | |
data Rental = Rental { cycle :: Cycle, rentedOn :: Int, returnedOn :: Maybe Int } deriving Show | |
cycles' :: [Cycle] | |
cycles' = [ Cycle "BSA" 1 10 | |
, Cycle "BSA 2" 2 100 | |
, Cycle "BSA 3" 3 200 ] |
(ns bikes.core | |
(:gen-class) | |
(:require [clj-time.core :as t])) | |
(defrecord Bike [model price id]) | |
(defrecord Store [bikes currentRentals rentHistory]) | |
(defrecord Rental [bikeId rentedOn returnedOn rent]) | |
(defn find-rental-for-bike | |
[store bike] |
(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) |
I hereby claim:
To claim this, I am signing this object:
;; 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 |
#!/usr/bin/env python3 | |
import sys | |
limit = 6 | |
mod = 10 ** limit | |
def mat_mul(m1, m2): |
; to define the loop macro | |
(defmacro loop_ [& body] `(while true ~@body)) | |
; Create the REPL! | |
(-> (read) (eval) (println) (loop_)) |
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): |
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] | |
} |