Skip to content

Instantly share code, notes, and snippets.

View kolharsam's full-sized avatar
🚀
Excelsior!

Sameer Kolhar kolharsam

🚀
Excelsior!
  • 06:26 (UTC -04:00)
View GitHub Profile
@kolharsam
kolharsam / truffle-material.md
Created May 9, 2020 08:36 — forked from smarr/truffle-material.md
Truffle: Languages and Material
@kolharsam
kolharsam / monads.clj
Created May 17, 2020 02:37 — forked from lispyclouds/monads.clj
Monads, simple made easier
; 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
@kolharsam
kolharsam / css-parser.md
Created May 22, 2020 12:57 — forked from kachayev/css-parser.md
Parsing CSS file with monadic parser in Clojure
@kolharsam
kolharsam / js_parser.clj
Created May 27, 2020 17:46 — forked from borkdude/js_parser.clj
Parse JavaScript in Clojure using the Google Closure Compiler
#!/bin/sh
#_(
"exec" "clojure" "-Sdeps" "{:deps {org.clojure/clojurescript {:mvn/version \"1.10.520\"}}}" "$0" "$@"
)
;; running js_parser.clj "function foo(x) { var y = x + 1; }" will print:
;; [{:type :function, :name "foo", :body [{:variable-statement [{:lvalue "y", :initializer {:type :binary-op, :left "x", :operator "+", :right "1"}}]}], :params ["x"]}]
@kolharsam
kolharsam / string-conversions.hs
Created May 29, 2021 05:58 — forked from dino-/string-conversions.hs
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-12.14 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).