Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Excelsior!

Sameer Kolhar kolharsam

🚀
Excelsior!
View GitHub Profile
@kolharsam
kolharsam / string-conversions.hs
Created May 29, 2021 — forked from dino-/string-conversions.hs
A handy illustration of converting between String, Text and ByteString in Haskell
View string-conversions.hs
#! /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).
@kolharsam
kolharsam / js_parser.clj
Created May 27, 2020 — forked from borkdude/js_parser.clj
Parse JavaScript in Clojure using the Google Closure Compiler
View js_parser.clj
#!/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 / css-parser.md
Created May 22, 2020 — forked from kachayev/css-parser.md
Parsing CSS file with monadic parser in Clojure
View css-parser.md
@kolharsam
kolharsam / monads.clj
Created May 17, 2020 — forked from lispyclouds/monads.clj
Monads, simple made easier
View monads.clj
; 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 / truffle-material.md
Created May 9, 2020 — forked from smarr/truffle-material.md
Truffle: Languages and Material
View truffle-material.md