Skip to content

Instantly share code, notes, and snippets.

Ambrose Bonnaire-Sergeant frenchy64

  • Bloomington, Indiana
Block or report user

Report or block frenchy64

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@frenchy64
frenchy64 / Clojure print jars classpath
Created Jan 24, 2011
Print the name of all jars in the classpath
View Clojure print jars classpath
(for [class
(sort (re-seq #"[-a-zA-Z0-9.]*\.jar" (System/getProperty "java.class.path" ".")))]
(println class))
@frenchy64
frenchy64 / Clojure CSV indexing
Created Jan 29, 2011
Clean way to grab a particular column of each row
View Clojure CSV indexing
;; http://stackoverflow.com/questions/4830900/how-do-i-find-the-index-of-an-item-in-a-vector/4831170#4831170
;; CSV File:
;; first-name, last-name, phone <- headers (column names)
;; Ambrose, BS, 234333
;; Chris, Squire, 4333
;; 1. Extract to vector
View .zshrc
# Set up the prompt
autoload -Uz promptinit
promptinit
prompt walters
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
@frenchy64
frenchy64 / Dispatch.java
Created Mar 11, 2011
Discussion on dispatch method of Java
View Dispatch.java
public class Dispatch {
public static void main(String[] args) {
// Start here
// Java uses single dispatch.
//
// Single dispatch is based on the runtime "type" of d, which is Dog.
Dog d = new Dog();
View Ambrose_output.xml
<collection xmlns:ands="http://www.ands.org.au/ontologies/ns/0.1/VITRO-ANDS.owl#"
xmlns:bibo="http://purl.org/ontology/bibo/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:vivo="http://vivoweb.org/ontology/core#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:event="http://purl.org/NET/c4dm/event.owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
View Logic-Bash-generator.clj
(ns logic-test.core
(:refer-clojure :exclude [inc reify ==])
(:use clojure.core.logic.prelude)
(:use clojure.core.logic.minikanren))
(defn secondo [l x]
(exist [r]
(resto l r)
(firsto r x)))
View gist:1073822
(run out-str
(js-statement out-str "println(\"asdf\");"))
#<StackOverflowError java.lang.StackOverflowError>
View gist:1084015
(run 4 [q]
(exist [a t]
(typedo [[:f :- a]
[:g :- :int]]
q
:int)))
;=> (:f
; :g
; [:apply :f :g]
View variable_names.clj
(ns logic-introduction.core
(:refer-clojure :exclude [inc reify ==])
(:use [clojure.core.logic minikanren prelude nonrel match disequality]))
(defn geto [key env value]
(matche [env]
([[[key :- value] . _]])
([[_ . ?rest]] (geto key ?rest value))))
(defn typedo [context exp resulttype]
View puzzled.clj
(ns logic-introduction.core
(:refer-clojure :exclude [inc reify ==])
(:use [clojure.core.logic minikanren prelude nonrel match disequality]))
(defn geto [key env value]
"Succeed if type association [key :- value] is found in vector env."
(matche [env]
([[[key :- value] . _]])
([[_ . ?rest]] (geto key ?rest value))))
You can’t perform that action at this time.