Mercurial > rlm
diff src/rlm/light_base.clj @ 0:78a630e650d2
initial import
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 18 Oct 2011 00:57:08 -0700 |
parents | |
children | c7df1ea6fd71 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/rlm/light_base.clj Tue Oct 18 00:57:08 2011 -0700 1.3 @@ -0,0 +1,243 @@ 1.4 +(ns rlm.light-base 1.5 + {:author "Robert McIntyre"} 1.6 + (:refer-clojure :only []) 1.7 + (:require [rlm [ns-rlm]])) 1.8 + 1.9 + 1.10 + 1.11 +;;We start with absolutely nothing and build from there 1.12 +(rlm.ns-rlm/ns-clear) ;; all we have is [def if ns in-ns]. 1.13 + 1.14 + 1.15 +(clojure.core/use 1.16 + :reload 1.17 + '[clojure 1.18 + [core 1.19 + :only 1.20 + [ 1.21 + ;; object stuff 1.22 + extend-type 1.23 + 1.24 + 1.25 + *command-line-args* *err* *out* *warn-on-reflection* val name read-line 1.26 + ;;REPL 1.27 + find-doc doc print-doc print-namespace-doc 1.28 + ;;Regexes 1.29 + re-pattern re-matcher re-groups re-seq re-matches re-find 1.30 + ;; Unsorted 1.31 + meta type with-meta vary-meta defmacro str let binding with-bindings bound-fn bound-fn* eval 1.32 + time macroexpand-1 macroexpand destructure comment test rand rand-int subs hash 1.33 + definline alter-var-root format printf defonce refer-clojure gen-class load letfn 1.34 + gen-interface definterface reify munge defrecord deftype extenders defprotocol 1.35 + extend extend-protocol slurp clojure-version char assert read 1.36 + ;; Printing 1.37 + print-method print-dup newline flush print println prn with-in-str with-out-str 1.38 + print-str println-str *print-length* *print-level* print-ctor primitives-classnames 1.39 + ;;Agents 1.40 + agent send send-off release-pending-sends 1.41 + add-watch remove-watch agent-error restart-agent set-error-handler! error-handler 1.42 + set-error-mode! error-mode shutdown-agents 1.43 + ;;Ref 1.44 + ref deref 1.45 + ;;Atom 1.46 + atom swap! compare-and-set! reset! set-validator! get-validator alter-meta! 1.47 + reset-meta! commute alter ref-set ref-history-count ref-min-history ref-max-history 1.48 + ensure sync dosync 1.49 + ;;MultiMethods 1.50 + defmulti defmethod remove-all-methods remove-method prefer-method 1.51 + methods get-method prefers 1.52 + ;;Numerics 1.53 + inc dec rem quot rationalize mod numerator denominator 1.54 + ;;Bits 1.55 + bit-and bit-or bit-xor bit-and-not bit-clear bit-set 1.56 + bit-flip bit-test bit-shift-left bit-shift-right 1.57 + ;; Logic 1.58 + not = 1.59 + ;; Creation 1.60 + symbol gensym keyword int declare num long float double short byte boolean 1.61 + bigint bigdec transient persistent! assoc! 1.62 + ;; Lists 1.63 + list list* rest next cons first second last butlast 1.64 + ;; Maps 1.65 + hash-map sorted-map sorted-map-by find select-keys keys vals 1.66 + merge merge-with zipmap create-struct defstruct struct-map struct get-in 1.67 + assoc-in update-in map-indexed key 1.68 + ;; Sets 1.69 + set sorted-set sorted-set-by disj split-at split-with 1.70 + ;; Vectors 1.71 + vector vec subvec vector-of 1.72 + ;; Arrays 1.73 + to-array into-array alength aclone aget aset aset-int aset-long 1.74 + aset-boolean aset-float aset-double aset-short aset-long aset-byte aset-char 1.75 + aset-int make-array to-array-2d amap areduce boolean-array byte-array char-array 1.76 + short-array double-array object-array int-array long-array booleans chars 1.77 + shorts floats ints doubles longs partition-all 1.78 + ;; Seqs 1.79 + lazy-seq nth rseq reverse concat peek pop sequence every? not-every? some 1.80 + not-any? take take-while drop drop-last take-last drop-while cycle repeat 1.81 + replicate iterate range line-seq sort sort-by partition doseq dorun doall 1.82 + take-nth interleave lazy-cat tree-seq file-seq xml-seq distinct 1.83 + replace subseq rsubseq interpose seque not-empty flatten group-by count 1.84 + partition-by frequencies shuffle 1.85 + ;; Functions 1.86 + fn defn defn- apply complement constantly identity comp juxt partial repeatedly 1.87 + trampoline memoize pmap pcalls pvalues fnil 1.88 + ;; List Comprehensions 1.89 + reduce reductions map mapcat filter remove keep keep-indexed for 1.90 + ;; Predicates 1.91 + instance? seq? char? string? map? vector? nil? 1.92 + false? true? symbol? keyword? delay? future? future-done? 1.93 + even? odd? contains? number? integer? ratio? decimal? reversible? 1.94 + float? rational? special-symbol? var? class? bound? thread-bound? counted? 1.95 + distinct? empty? coll? list? set? ifn? fn? associative? sequential? sorted? 1.96 + extends? satisfies? future-cancelled? 1.97 + comparator 1.98 + ;; Comparason 1.99 + compare not= identical? == 1.100 + ;; Control Flow 1.101 + when when-not cond delay force if-not and or locking -> ->> while case 1.102 + if-let when-let dotimes await await-for with-open doto loop condp future-call 1.103 + future future-cancel promise deliver 1.104 + ;;Namespaces 1.105 + create-ns find-ns remove-ns all-ns the-ns ns-name ns-map ns-unmap ns-publics 1.106 + ns-imports ns-interns refer ns-refers alias ns-aliases ns-unalias ns-resolve 1.107 + resolve ns require use loaded-libs compile intern namespace-munge 1.108 + ;; Java 1.109 + .. import class enumeration-seq 1.110 + ;;Objects 1.111 + bases make-hierarchy supers isa? parents ancestors descendants derive underive 1.112 + ;; Symbols 1.113 + *ns* *1 *2 *3 *e *compile-path* 1.114 + ;; Proxies 1.115 + get-proxy-class construct-proxy init-proxy update-proxy proxy-mappings proxy 1.116 + proxy-super bean 1.117 + ;; Vars 1.118 + var-get 1.119 + 1.120 + ]]] 1.121 + 1.122 + 1.123 + '[rlm 1.124 + [function-utils :only [mix defmix runonce]] 1.125 + [rlm-commands :only [undef ns-reset ns-nuke reload keymap-clojure keymap-normal rlm]] 1.126 + [ns-rlm :only [ns-clear ns-clone ls]] 1.127 + [play-all :only [play-all-music]] 1.128 + [shell-inspect :only [command-line?]] 1.129 + [shell-write :only [sw]] 1.130 + [classpath-utils :only [classpath add-to-classpath]] 1.131 + [dreams :only [megadef megaundef silence]] 1.132 + [map-utils :only [map-keys map-vals filter-keys filter-vals]] 1.133 + [decorators :only [preserve-meta]] 1.134 + [visualize :only [visual]] 1.135 + [identify :only [identify]] 1.136 + [push :only [push-gen push]] 1.137 + ] 1.138 + '[coderloop 1.139 + [utils :only [read-integer read-big-integer read-integers trans-print digits]] 1.140 + [export-files :only [export-archive]]] 1.141 + 1.142 + '[sunil 1.143 + [curry :only [decorate curry defn-decorated]]] 1.144 + 1.145 + '[clojure.contrib 1.146 + [import-static :only [import-static]] 1.147 + [combinatorics :only [cartesian-product subsets selections 1.148 + permutations lex-permutations combinations]] 1.149 + [duck-streams :only [file-str read-lines]] 1.150 + [str-utils :only [re-split re-gsub str-join]] 1.151 + [seq :only [separate indexed rotations find-first positions]] 1.152 + [math :only [expt round gcd lcm floor ceil]] 1.153 + [repl-utils :only [show expression-info]] 1.154 + [def :only [defn-memo defvar defmacro-]] 1.155 + 1.156 + 1.157 + ] 1.158 + 1.159 + '[clojure.contrib.generic 1.160 + [arithmetic :only [+ - / *]] 1.161 + [collection :only [assoc conj dissoc get empty into seq]] 1.162 + [comparison :only [pos? neg? zero? > < <= >= max min]] 1.163 + [math-functions :only 1.164 + [sqr approx= conjugate sgn acos asin atan atan2 1.165 + cos exp log pow rint sin tan]] 1.166 + [functor :only [fmap]]] 1.167 + 1.168 + '[matchure :only [fn-match defn-match if-match when-match cond-match]] 1.169 + 1.170 + 1.171 +;; '[letd :only [with-separator display-local-bindings letd]] 1.172 + 1.173 + '[clojure 1.174 + [repl :only [source]]] 1.175 + 1.176 + '[clojure.java 1.177 + [javadoc :only [javadoc add-local-javadoc]]] 1.178 + 1.179 +) 1.180 + 1.181 +;;java stuff 1.182 + 1.183 +(import '[java.lang ProcessBuilder Enum SuppressWarnings Throwable 1.184 + InterruptedException Thread$UncaughtExceptionHandler RuntimeException 1.185 + Thread$State ArrayIndexOutOfBoundsException IllegalAccessError Process 1.186 + SecurityException InstantiationException ThreadGroup System 1.187 + EnumConstantNotPresentException OutOfMemoryError Double Package 1.188 + ExceptionInInitializerError RuntimePermission UnknownError 1.189 + IncompatibleClassChangeError 1.190 + ArithmeticException StackTraceElement NoSuchFieldError InternalError Thread 1.191 + SecurityManager Cloneable NegativeArraySizeException StringBuilder Appendable 1.192 + Byte Math Exception IllegalAccessException ClassNotFoundException 1.193 + UnsatisfiedLinkError 1.194 + IllegalArgumentException AssertionError Short StrictMath ClassCircularityError 1.195 + NoSuchFieldException Comparable Readable UnsupportedClassVersionError 1.196 + IllegalThreadStateException Iterable Object VirtualMachineError 1.197 + InheritableThreadLocal 1.198 + ThreadLocal ClassLoader CloneNotSupportedException TypeNotPresentException 1.199 + Void 1.200 + Character NoClassDefFoundError IllegalStateException LinkageError Boolean 1.201 + String 1.202 + InstantiationError Float Runnable IndexOutOfBoundsException ClassFormatError 1.203 + NullPointerException NoSuchMethodError ClassCastException Class 1.204 + StringIndexOutOfBoundsException Override ThreadDeath CharSequence Number 1.205 + IllegalMonitorStateException Error NumberFormatException VerifyError 1.206 + StringBuffer 1.207 + NoSuchMethodException Long ArrayStoreException UnsupportedOperationException 1.208 + Integer 1.209 + Deprecated StackOverflowError AbstractMethodError Runtime] 1.210 + '[java.math BigDecimal BigInteger] 1.211 + 'java.util.concurrent.Callable 1.212 + 'clojure.lang.Compiler 1.213 + ) 1.214 + 1.215 +;; jme3 stuff 1.216 + 1.217 +(set! clojure.core/*print-length* 20) 1.218 + 1.219 +(clojure.java.javadoc/add-local-javadoc "/home/r/mobius/temp-clj/javadoc") 1.220 + 1.221 + 1.222 +(clojure.java.javadoc/add-local-javadoc "/home/r/roBin/jdk6-docs/docs/api") 1.223 +(clojure.java.javadoc/add-local-javadoc 1.224 + "/home/r/roBin/lpsolve-doc/lpsolve.sourceforge.net/5.5/Java/docs/api") 1.225 + 1.226 + 1.227 +(defmethod / [java.lang.Number java.lang.Number] 1.228 + [x y] (clojure.core// x y)) 1.229 + 1.230 +(defmethod - [java.lang.Number java.lang.Number] 1.231 + [x y] (clojure.core/- x y)) 1.232 + 1.233 +(import-static java.lang.Math PI E) 1.234 + 1.235 + 1.236 + 1.237 + 1.238 + 1.239 + 1.240 + 1.241 + 1.242 + 1.243 + 1.244 + 1.245 + 1.246 +