Skip to content

Instantly share code, notes, and snippets.

samuel@samuel-XPS-13-9360:~/code/memory-game$ buildozer android clean
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Run '/usr/bin/python -m pythonforandroid.toolchain clean_builds --color=always --storage-dir=/home/samuel/code/memory-game/.buildozer/android/platform/build'
# Cwd /home/samuel/code/memory-game/.buildozer/android/platform/python-for-android-new-toolchain
# Run '/usr/bin/python -m pythonforandroid.toolchain clean_dists --color=always --storage-dir=/home/samuel/code/memory-game/.buildozer/android/platform/build'
# Cwd /home/samuel/code/memory-game/.buildozer/android/platform/python-for-android-new-toolchain
samuel@samuel-XPS-13-9360:~/code/memory-game$ buildozer android debug deploy run
# Check configuration tokens
import kivy
from kivy.clock import Clock
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
def on_enter(instance):
print '============== still in "global?" on_enter() ===================='
@Eskatrem
Eskatrem / derivatives.lisp
Created November 3, 2013 15:21
Proof of concept of a program that makes the derivative operator a first class citizen.
(defparameter *maths-functions* (list))
(defmacro defun-maths (func-name args core)
"appends the code of func-name into maths-functions."
`(progn
(push (list :name (quote ,func-name) :variable (quote ,args) :core (quote ,core)) *maths-functions*)
(defun ,func-name ,args ,core)))
(defun get-source (func-name)
(car (remove-if-not (lambda (f) (eql (getf f :name) func-name)) *maths-functions*
@Eskatrem
Eskatrem / derivator-first-class.lisp
Created October 28, 2013 19:43
Attempt to write the derivative as a first class operator
(defparameter *maths-functions* (list))
(defmacro defun-maths (func-name args core)
"appends the code of func-name into maths-functions."
`(progn
(push (list (quote ,func-name) (quote ,@args) (quote ,core)) *maths-functions*)
(defun ,func-name ,args ,core)))
@Eskatrem
Eskatrem / save-source.lisp
Created October 28, 2013 15:15
macro to make the code of a function available while defining that function
(defparameter *maths-functions* (list))
(defmacro defun-maths (func-name args core)
"appends the code of func-name into maths-functions."
`(progn
(push (list (quote ,func-name) (quote ,@args) (quote ,core)) *maths-functions*)
(defun ,func-name ,args ,core)))
(defun eq-assoc (assoc-a assoc-b)
(and (equal (length assoc-a) (length assoc-b))
(reduce (lambda (accum pair)
(and accum
(equal pair (assoc (car pair) assoc-b))))
assoc-a
:initial-value t)))
(defun group (list)
(let ((even t))
@Eskatrem
Eskatrem / newton-raphson.clj
Created September 22, 2013 23:45
Implementation of Newton Raphson algorithm in clojure
(ns newton-raphson.core)
;;utility function for list manipulation
(defn keep-list [expr]
(if (and (coll? expr) (not (= 1 (count expr)))) (list expr) expr))
(defn to-list [expr]
(cond (list? expr) expr
(coll? expr) (seq expr)
(fn [x n]
(loop [res (), k 0]
(cond (>= k n) (if (list? x) res (reverse res))
:else (recur (conj res (filter #(= k (mod % n)) x)) (inc k)))))
(defn is-palindrome [x]
(= x (Integer/parseInt (apply str (reverse (str x)))))
)
(defn problem4 []
;Find the largest palindrome made from the product of two 3-digit numbers.
(def max-palindrome 0)
(doseq [i (range 999)]
(doseq [j (range i)]
(do
(defn get-prime-factors [n-arg]
;(def n n-arg)
(def prime-factors (list))
(loop [p 2 n n-arg :while (> n 1)]
(println (str "p=" p " n=" n))
;(while (> n 1)
(println n)
(println (class n))
(if (= 0 (mod n p))