-
Add Graal JIT Compilation to Your JVM Language in 5 Steps, A Tutorial http://stefan-marr.de/2015/11/add-graal-jit-compilation-to-your-jvm-language-in-5-easy-steps-step-1/
-
The SimpleLanguage, an example of using Truffle with great JavaDocs. It is the officle getting-started project: https://github.com/graalvm/simplelanguage
-
Truffle Tutorial, Christan Wimmer, PLDI 2016, 3h recording https://youtu.be/FJY96_6Y3a4 Slides
This file contains hidden or 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
from os import system | |
start_grid = [line.rstrip('\n') for line in open("input")] | |
def printGrid(grid): | |
print("\n\n\n\n\n\n\n\n\n\n\n") | |
for r in grid: | |
print (''.join(r)) | |
def getLightsOn(grid): | |
counter = 0 |
This file contains hidden or 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
/* | |
Runtime Env: | |
- Node v10.16.0 | |
*/ | |
/* | |
Problem Statement - Lisp Parser | |
Write code that takes some Lisp code and returns an abstract syntax tree. | |
The AST should represent the structure of the code and the meaning of each token. |
This file contains hidden or 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
import qualified Data.List as List | |
listSum :: (Num a) => [a] -> a | |
listSum [] = 0 | |
listSum xs = foldr (+) 0 xs | |
getLength :: (Num a) => [a] -> a | |
getLength xs = foldr (\_ acc -> acc + 1) 0 xs | |
myGroup :: (Num a, Eq a, Ord a) => [a] -> [(a, Int)] |
This file contains hidden or 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
const compress = sortedArr => { | |
let currentLetterIndex = 0, letterCounter = 0, iter = 0; | |
// if we one of each letter | |
let maxIterations = sortedArr.length * 2; | |
while(iter < maxIterations) { | |
if (sortedArr[iter] === sortedArr[currentLetterIndex]) { | |
letterCounter++; | |
iter++; |
This file contains hidden or 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 multiply-two [x] (* x 2)) | |
(defn sub-one [x] (dec x)) | |
(defn broken-calc | |
([start goal] (broken-calc start goal 0)) | |
([start goal steps] | |
(if | |
(= start goal) | |
steps |
This file contains hidden or 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 resultant_string | |
[str_a] | |
(loop [letters (clojure.string/split (apply str (reverse str_a)) #"") | |
letter_stack []] | |
(if (empty? letters) | |
(clojure.string/join letter_stack) | |
(let [current (peek letters)] | |
(if (= current "#") | |
(recur (pop letters) (if (empty? letter_stack) letter_stack (pop letter_stack))) | |
(recur (pop letters) (conj letter_stack current))))))) |
This file contains hidden or 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.math.combinatorics :as combo] | |
'[clojure.string :as str]) | |
(defn validParenthesis? | |
"Returns true if a sequence of parentheses are balanced" | |
[coll] | |
(loop [parens_list (apply list coll) | |
stack []] | |
(if (empty? parens_list) | |
(empty? stack) |
This file contains hidden or 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
(def default-input ["candy" "doodle" "pop" "shield" "lag" "typewriter" "this"]) | |
(def qwerty-rows ["qwertyuiop" "asdfghjkl" "zxcvbnm"]) | |
(def dvorak-rows ["pyfgcrl" "aoeuidhtns" "qjkxbmwvz"]) | |
(def azerty-rows ["azertyuiop" "qsdfghjklm" "wxcvbn"]) | |
(defn get-letter-row | |
"Returns the index of the row in which the letter is present" |
This file contains hidden or 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
;; Simple to implement I guess the real problem is of double/float precision | |
;; Will be updating once I learn more about those concepts within Clojure | |
(defn is-in-golden-ratio? | |
"Returns true if the pair of numbers are in the golden ratio" | |
[x y] | |
(let [x-y-ratio (quot x y) | |
greatest (max x y) | |
sum-ratio (quot (+ x y) greatest)] | |
(= x-y-ratio sum-ratio))) |
OlderNewer