diff --git a/pom.xml b/pom.xml
index 2171fd7..c9953bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -172,6 +172,12 @@
3.0.0
+
+ org.reflections
+ reflections
+ 0.9.11
+
+
org.assertj
assertj-core
diff --git a/src/main/kotlin/function/FunctionNames.kt b/src/main/kotlin/function/FunctionNames.kt
index cb32a7b..cf2acd5 100644
--- a/src/main/kotlin/function/FunctionNames.kt
+++ b/src/main/kotlin/function/FunctionNames.kt
@@ -1,9 +1,6 @@
package function
-import kotlin.annotation.AnnotationRetention.RUNTIME
import kotlin.annotation.AnnotationTarget.CLASS
-import kotlin.annotation.AnnotationTarget.FILE
-@Retention(RUNTIME)
-@Target(CLASS, FILE)
+@Target(CLASS)
annotation class FunctionNames(vararg val value: String)
diff --git a/src/main/kotlin/sexpression/DisplayName.kt b/src/main/kotlin/sexpression/DisplayName.kt
index 8c65814..d21c614 100644
--- a/src/main/kotlin/sexpression/DisplayName.kt
+++ b/src/main/kotlin/sexpression/DisplayName.kt
@@ -1,9 +1,6 @@
package sexpression
-import kotlin.annotation.AnnotationRetention.RUNTIME
import kotlin.annotation.AnnotationTarget.CLASS
-import kotlin.annotation.AnnotationTarget.FILE
-@Retention(RUNTIME)
-@Target(CLASS, FILE)
+@Target(CLASS)
annotation class DisplayName(val value: String)
diff --git a/src/main/kotlin/table/FunctionTable.kt b/src/main/kotlin/table/FunctionTable.kt
index 403b5db..e1b4a91 100644
--- a/src/main/kotlin/table/FunctionTable.kt
+++ b/src/main/kotlin/table/FunctionTable.kt
@@ -3,106 +3,16 @@ package table
import error.CriticalLispException
import function.FunctionNames
import function.LispFunction
-import function.builtin.APPLY
-import function.builtin.Eval
-import function.builtin.Exit
-import function.builtin.FUNCALL
-import function.builtin.FUSE
-import function.builtin.GENSYM
-import function.builtin.LOAD
-import function.builtin.PRINT
-import function.builtin.SET
-import function.builtin.SYMBOLS
-import function.builtin.SYMBOL_FUNCTION
-import function.builtin.cons.APPEND
-import function.builtin.cons.CONS
-import function.builtin.cons.FIRST
-import function.builtin.cons.LENGTH
-import function.builtin.cons.LIST
-import function.builtin.cons.REST
-import function.builtin.math.DIVIDE
-import function.builtin.math.MINUS
-import function.builtin.math.MODULO
-import function.builtin.math.MULTIPLY
-import function.builtin.math.PLUS
-import function.builtin.math.REMAINDER
-import function.builtin.predicate.ATOM
-import function.builtin.predicate.EQ
-import function.builtin.predicate.EQUAL
-import function.builtin.predicate.GENSYM_EQUAL
-import function.builtin.predicate.LISTP
-import function.builtin.predicate.NULL
-import function.builtin.predicate.NUMERIC_GREATER
-import function.builtin.predicate.NUMERIC_LESS
-import function.builtin.predicate.NumericEqual
-import function.builtin.special.AND
-import function.builtin.special.CASE
-import function.builtin.special.COND
-import function.builtin.special.DEFINE_SPECIAL
-import function.builtin.special.DEFMACRO
-import function.builtin.special.DEFUN
-import function.builtin.special.IF
-import function.builtin.special.LET
-import function.builtin.special.LET_STAR
-import function.builtin.special.Lambda
-import function.builtin.special.OR
-import function.builtin.special.PROGN
-import function.builtin.special.QUOTE
-import function.builtin.special.RECUR
-import function.builtin.special.SETQ
+import org.reflections.Reflections
object FunctionTable {
- private val allBuiltIns = setOf(
- AND::class.java,
- APPEND::class.java,
- APPLY::class.java,
- ATOM::class.java,
- CASE::class.java,
- COND::class.java,
- CONS::class.java,
- DEFINE_SPECIAL::class.java,
- DEFMACRO::class.java,
- DEFUN::class.java,
- DIVIDE::class.java,
- EQ::class.java,
- EQUAL::class.java,
- NumericEqual::class.java,
- Eval::class.java,
- Exit::class.java,
- FIRST::class.java,
- FUNCALL::class.java,
- FUSE::class.java,
- GENSYM::class.java,
- GENSYM_EQUAL::class.java,
- NUMERIC_GREATER::class.java,
- IF::class.java,
- Lambda::class.java,
- LENGTH::class.java,
- NUMERIC_LESS::class.java,
- LET::class.java,
- LET_STAR::class.java,
- LIST::class.java,
- LISTP::class.java,
- LOAD::class.java,
- MINUS::class.java,
- MODULO::class.java,
- MULTIPLY::class.java,
- NULL::class.java,
- OR::class.java,
- PLUS::class.java,
- PRINT::class.java,
- PROGN::class.java,
- QUOTE::class.java,
- RECUR::class.java,
- REMAINDER::class.java,
- REST::class.java,
- SET::class.java,
- SETQ::class.java,
- SYMBOL_FUNCTION::class.java,
- SYMBOLS::class.java)
-
private val table = mutableMapOf()
+ private val reflections = Reflections("function")
+ private val allBuiltIns =
+ reflections.getTypesAnnotatedWith(FunctionNames::class.java)
+ .filterIsInstance>()
+ .toSet()
init {
initializeFunctionTable(allBuiltIns)