diff --git a/.apl.history b/.apl.history new file mode 100644 index 00000000..e69de29b diff --git a/README.md b/README.md index cd9123ad..fcc59ff1 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# Apex +# April Ken Iverson's masterpiece reflected in the medium of Lisp. -Apex compiles a subset of the APL programming language into Common Lisp. Leveraging Lisp's powerful macros and numerical processing faculties, it brings APL's expressive potential to bear for Lisp developers. Replace hundreds of lines of number-crunching code with a single line of APL. +April compiles a subset of the APL programming language into Common Lisp. Leveraging Lisp's powerful macros and numerical processing faculties, it brings APL's expressive potential to bear for Lisp developers. Replace hundreds of lines of number-crunching code with a single line of APL. -## Why Apex? +## Why April? APL veritably hums with algorithmic power. As a handful of characters run past the lexer, vast fields of data grow, morph and distil to reveal their secrets. However, APL has hitherto dwelt in an ivory tower, secluded inside monolithic runtime environments. If you have a store of data you'd like to use with APL, getting it there can be an ordeal. Like hauling tons of cargo on donkeys' backs through a narrow mountain pass, it's not fun, and the prospect of it has ended many discussions of APL before they could begin. @@ -16,67 +16,67 @@ But no longer. Lisp is the great connector of the software world, digesting and ## Installation -Apex depends on Common Lisp, ASDF and Quicklisp. The only Common Lisp implementation tested so far has been Steel Bank Common Lisp (SBCL). +April depends on Common Lisp, ASDF and Quicklisp. The only Common Lisp implementation tested so far has been Steel Bank Common Lisp (SBCL). ### Preparing Quicklisp -Enter your Quicklisp local-projects directory (usually ~/quicklisp/local-projects) and create a symbolic link to the directory where you cloned the Apex repository. For example, if you cloned the repo to ~/mystuff/apex and your Quicklisp directory is ~/quicklisp/, enter: +Enter your Quicklisp local-projects directory (usually ~/quicklisp/local-projects) and create a symbolic link to the directory where you cloned the April repository. For example, if you cloned the repo to ~/mystuff/april and your Quicklisp directory is ~/quicklisp/, enter: ``` cd ~/quicklisp/local-projects -ln -s ~/mystuff/apex +ln -s ~/mystuff/april ``` -### Installing Apex +### Installing April To complete the installation, just start a Common Lisp REPL and enter: ``` -(ql:quickload 'apex) +(ql:quickload 'april) ``` And the system will be built and ready. ## APL Functions and Operators -The APL language uses single characters to represent its primitive functions and operators. Most of these symbols are not part of the standard ASCII character set but are unique to APL. To see a list of the glyphs that are supported by Apex, visit the link below. +The APL language uses single characters to represent its primitive functions and operators. Most of these symbols are not part of the standard ASCII character set but are unique to APL. To see a list of the glyphs that are supported by April, visit the link below. -#### [See the complete Apex APL lexicon here.](./lexicon.md) +#### [See the complete April APL lexicon here.](./lexicon.md) -Some APL functions and operators won't be added to Apex since they don't make sense for Apex's design as a compiler from APL to Lisp. Others may be added in the future. [See the list of features not implemented here.](#whats-not-implemented-and-may-be) +Some APL functions and operators won't be added to April since they don't make sense for April's design as a compiler from APL to Lisp. Others may be added in the future. [See the list of features not implemented here.](#whats-not-implemented-and-may-be) ## Examples Evaluating an APL expression is as simple as: ``` -* (apex "1+2 3 4") +* (april "1+2 3 4") #(3 4 5) ``` The * indicates a REPL prompt. The text two lines down is the expression's output. -The macro (apex) will evaluate any APL string passed to it as the sole argument, returning the final result. +The macro (april) will evaluate any APL string passed to it as the sole argument, returning the final result. Setting state properties for the APL instance can be done like this: ``` -* (apex (set (:state :count-from 0)) "⍳9") +* (april (set (:state :count-from 0)) "⍳9") #(0 1 2 3 4 5 6 7 8) ``` -Instead of an APL string, the first argument to (apex) may be a list of specifications for the APL environment. The APL expression is then passed in the second argument. +Instead of an APL string, the first argument to (april) may be a list of specifications for the APL environment. The APL expression is then passed in the second argument. For example, you can use this configuration setting to determine whether the APL instance will start counting from 0 or 1. ``` -* (apex (set (:state :count-from 1)) "⍳9") +* (april (set (:state :count-from 1)) "⍳9") #(1 2 3 4 5 6 7 8 9) -* (apex (set (:state :count-from 0)) "⍳9") +* (april (set (:state :count-from 0)) "⍳9") #(0 1 2 3 4 5 6 7 8) ``` @@ -84,68 +84,68 @@ For example, you can use this configuration setting to determine whether the APL More APL expressions: ``` -* (apex "⍳12") +* (april "⍳12") #(1 2 3 4 5 6 7 8 9 10 11 12) -* (apex "3 4⍴⍳12") +* (april "3 4⍴⍳12") #2A((1 2 3 4) (5 6 7 8) (9 10 11 12)) -* (apex "+/3 4⍴⍳12") +* (april "+/3 4⍴⍳12") #(10 26 42) -* (apex "+⌿3 4⍴⍳12") +* (april "+⌿3 4⍴⍳12") #(15 18 21 24) -* (apex "+/[1]3 4⍴⍳12") +* (april "+/[1]3 4⍴⍳12") #(15 18 21 24) -* (apex "⌽3 4⍴⍳12") +* (april "⌽3 4⍴⍳12") #2A((4 3 2 1) (8 7 6 5) (12 11 10 9)) -* (apex "1⌽3 4⍴⍳12") +* (april "1⌽3 4⍴⍳12") #2A((2 3 4 1) (6 7 8 5) (10 11 12 9)) ``` ## Parameter reference -When the (apex) macro is called, you may pass it either a single text string: +When the (april) macro is called, you may pass it either a single text string: ``` -* (apex "1+1 2 3") +* (april "1+1 2 3") ``` Or a parameter object followed by a text string: ``` -* (apex (set (:state :count-from 0)) "⍳9") +* (april (set (:state :count-from 0)) "⍳9") ``` -This section details the parameters you can pass to Apex. +This section details the parameters you can pass to April. ### (test) -To run Apex's test suite, just enter: +To run April's test suite, just enter: ``` -* (apex (test)) +* (april (test)) ``` ### (set) -(set) is the workhorse of Apex parameters, allowing you to configure your Apex instance in many ways. The most common sub-parameter passed via (set) is (:state). To wit: +(set) is the workhorse of April parameters, allowing you to configure your April instance in many ways. The most common sub-parameter passed via (set) is (:state). To wit: ``` -* (apex (set (:state :count-from 1 - :in ((a 1) (b 2)) - :out (a c))) - "c←a+b×11") +* (april (set (:state :count-from 1 + :in ((a 1) (b 2)) + :out (a c))) + "c←a+b×11") 1 23 @@ -157,15 +157,15 @@ Let's learn some more about what's going on in that code. The sub-parameters of #### :count-from -Sets the index from which Apex counts. Almost always set to 0 or 1. The default value is 1. +Sets the index from which April counts. Almost always set to 0 or 1. The default value is 1. #### :in -Passes variables into the Apex instance that may be used when evaluating the subsequent expressions. In the example above, the variables "a" and "b" are set in the code, with values 1 and 2 respectively. You can use :in to pass values from Lisp into the Apex instance. +Passes variables into the April instance that may be used when evaluating the subsequent expressions. In the example above, the variables "a" and "b" are set in the code, with values 1 and 2 respectively. You can use :in to pass values from Lisp into the April instance. -Please note that Apex variables follow a stricter naming convention than Lisp variables. When naming variables, only alphanumeric characters, periods and dashes may be used. Punctuation marks like ?, > and ! must not be used as they have separate meanings in Apex. +Please note that April variables follow a stricter naming convention than Lisp variables. When naming variables, only alphanumeric characters, periods and dashes may be used. Punctuation marks like ?, > and ! must not be used as they have separate meanings in April. -These characters may be used in Apex variable names: +These characters may be used in April variable names: ``` 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.∆⍙ ``` @@ -180,24 +180,24 @@ These are not ok: true! this->that pass/fail? ``` -Note also that variables are converted from Lisp-style dash-separated format into camel case for use within Apex code. For example: +Note also that variables are converted from Lisp-style dash-separated format into camel case for use within April code. For example: ``` -* (apex (set (:state :in ((my-var 2) +* (april (set (:state :in ((my-var 2) (other-var 5)))) - "myVar×otherVar+5") + "myVar×otherVar+5") 20 ``` #### :out -Lists variables to be output when the code has finished evaluating. By default, the value of the last evaluated expression is passed back after an Apex evaluation is finished. For example: +Lists variables to be output when the code has finished evaluating. By default, the value of the last evaluated expression is passed back after an April evaluation is finished. For example: ``` -* (apex "1+2 - 2+3 - 3+4") +* (april "1+2 + 2+3 + 3+4") 7 ``` @@ -205,10 +205,10 @@ Lists variables to be output when the code has finished evaluating. By default, The last value calculated is displayed. The :out sub-parameter allows you to list a set of variables that whose values will be returned once evaluation is complete. For example: ``` -* (apex (set (:state :out (a b c))) - "a←9+2 - b←5+3 - c←2×9") +* (april (set (:state :out (a b c))) + "a←9+2 + b←5+3 + c←2×9") 11 8 @@ -217,16 +217,16 @@ The last value calculated is displayed. The :out sub-parameter allows you to lis #### :disclose-output -In APL, there's really no such thing as a value outside an array. Every piece of data used within an Apex instance is an array. When you enter something like 1+1, you're actually adding two arrays containing a single value, 1, and outputting another array containing the value 2. When Apex returns arrays like this, its default behavior is to disclose them like this: +In APL, there's really no such thing as a value outside an array. Every piece of data used within an April instance is an array. When you enter something like 1+1, you're actually adding two arrays containing a single value, 1, and outputting another array containing the value 2. When April returns arrays like this, its default behavior is to disclose them like this: ``` -* (apex "1+1") +* (april "1+1") 2 ``` But if you set the :disclose-output option to nil, you can change this: ``` -* (apex (set (:state :disclose-output nil)) "1+1") +* (april (set (:state :disclose-output nil)) "1+1") #(2) ``` @@ -235,18 +235,18 @@ With :disclose-output set to nil, unitary vectors will be passed directly back w ### (:space) sub-parameter -If you want to create a persistent workspace where the functions and variables you've created are stored and can be used in multiple calls to Apex, use the (:space) parameter. For example: +If you want to create a persistent workspace where the functions and variables you've created are stored and can be used in multiple calls to April, use the (:space) parameter. For example: ``` -* (apex (set (:space *space1*)) "a←5+2 ◊ b←3×9") +* (april (set (:space *space1*)) "a←5+2 ◊ b←3×9") 27 -* (apex (set (:space *space1*)) "c←{⍵+2}") +* (april (set (:space *space1*)) "c←{⍵+2}") # -* (apex (set (:space *space1*)) "c a+b") +* (april (set (:space *space1*)) "c a+b") 36 ``` @@ -260,30 +260,30 @@ You can use the :state-persistent parameter to set state values within the works For example: ``` -* (apex (set (:state-persistent :count-from 0) (:space *space1*)) "⍳7") +* (april (set (:state-persistent :count-from 0) (:space *space1*)) "⍳7") #(0 1 2 3 4 5 6) -* (apex (set (:space *space1*)) "⍳7") +* (april (set (:space *space1*)) "⍳7") #(0 1 2 3 4 5 6) -* (apex (set (:space *space2*)) "⍳7") +* (april (set (:space *space2*)) "⍳7") #(1 2 3 4 5 6 7) ``` Did you notice that when switching to a different space, in this case *space2*, the customized values are lost? Custom state settings affect only the specific workspace where they are set. -You can use :state-persistent to set persistent input variables that will stay avaialable for each piece of code you run in your Apex instance. If these input variables refer to external Lisp variables, changing the external variables will change the values available to Apex. Like this: +You can use :state-persistent to set persistent input variables that will stay avaialable for each piece of code you run in your April instance. If these input variables refer to external Lisp variables, changing the external variables will change the values available to April. Like this: ``` * (defvar *dynamic-var* 2) *DYNAMIC-VAR* -* (apex (set (:state-persistent :in ((dyn-var *dynamic-var*))) - (:space *space1*)) +* (april (set (:state-persistent :in ((dyn-var *dynamic-var*))) + (:space *space1*)) "dynVar⍟512") #(9.0) @@ -292,17 +292,17 @@ You can use :state-persistent to set persistent input variables that will stay a 8 -* (apex (set (:space *space1*)) "dynVar⍟512") +* (april (set (:space *space1*)) "dynVar⍟512") #(3.0) ``` ### (:compile-only) parameter -If you just want to compile the code you enter into Apex without running it, use this option. For example: +If you just want to compile the code you enter into April without running it, use this option. For example: ``` -* (apex (set (:compile-only)) "1+1 2 3") +* (april (set (:compile-only)) "1+1 2 3") (PROGN (DISCLOSE @@ -311,10 +311,10 @@ If you just want to compile the code you enter into Apex without running it, use ### (restore-defaults) -To restore all of Apex's state variables to the default values, enter: +To restore all of April's state variables to the default values, enter: ``` -* (apex (restore-defaults)) +* (april (restore-defaults)) ``` All :in and :out values will be nullified, :count-from will return to its default setting, etc. @@ -352,7 +352,7 @@ All :in and :out values will be nullified, :count-from will return to its defaul ⌶ I-Beam ``` -See a pattern? The functions not planned for implentation are all those that manifest low-level interactions between the APL instance and the underlying computer system. Common Lisp already has powerful tools for system interaction, so it's presumed that developers will do things like this outside of Apex. +See a pattern? The functions not planned for implentation are all those that manifest low-level interactions between the APL instance and the underlying computer system. Common Lisp already has powerful tools for system interaction, so it's presumed that developers will do things like this outside of April. ## Also Not Implemented @@ -363,11 +363,11 @@ System functions and variables within APL are not implemented, along with APL's If you missed it earlier, you can run tests for the implemented APL functions and operators by entering: ``` -(apex (test)) +(april (test)) ``` ## Thanks to: -Tamas K. Papp, creator of [array-operations](https://github.com/tpapp/array-operations), of which Apex makes heavy use. +Tamas K. Papp, creator of [array-operations](https://github.com/tpapp/array-operations), of which April makes heavy use. -Max Rottenkolber, creator of [MaxPC](https://github.com/eugeneia/maxpc), the heart of Apex's parsing engine. \ No newline at end of file +Max Rottenkolber, creator of [MaxPC](https://github.com/eugeneia/maxpc), the heart of April's parsing engine. \ No newline at end of file diff --git a/apex.asd b/april.asd similarity index 57% rename from apex.asd rename to april.asd index 80ce5058..62cd1a65 100644 --- a/apex.asd +++ b/april.asd @@ -1,7 +1,7 @@ -;;;; apex.asd +;;;; april.asd -(asdf:defsystem #:apex - :description "Apex is a subset of the APL programming language that compiles to Common Lisp." +(asdf:defsystem #:april + :description "April is a subset of the APL programming language that compiles to Common Lisp." :author "Andrew Sengul" :license "Apache-2.0" :serial t @@ -9,4 +9,4 @@ :cl-ppcre :parse-number :symbol-munger :prove) :components ((:file "package") - (:file "apex"))) + (:file "april"))) diff --git a/apex.lisp b/april.lisp similarity index 97% rename from apex.lisp rename to april.lisp index 81f7cf1b..ce858ef6 100644 --- a/apex.lisp +++ b/april.lisp @@ -1,6 +1,6 @@ -;;;; apex.lisp +;;;; april.lisp -(in-package #:apex) +(in-package #:april) (defun is-singleton (value) "Determine whether an array is a singleton, i.e. possesses just one member." @@ -270,9 +270,9 @@ (mapcar (lambda (vector) (if vector (if (= 1 (length vector)) (- (aref vector 0) - (of-state *apex-idiom* :count-from)) + (of-state *april-idiom* :count-from)) (mapcar (lambda (elem) - (- elem (of-state *apex-idiom* + (- elem (of-state *april-idiom* :count-from))) (array-to-list vector))))) ,(cons 'list (rest (funcall subprocessor idiom meta @@ -572,7 +572,7 @@ ,(if first-axis 0 `(1- (rank new-array))))))))))) (vex-spec - apex + april (state :count-from 1 :disclose-output t :atomic-vector @@ -611,13 +611,13 @@ :postprocess-compiled (lambda (form) ;; wrap the last element of the compiled output in a disclose form if discloseOutput is set - (if (of-state *apex-idiom* :disclose-output) + (if (of-state *april-idiom* :disclose-output) (append (butlast form) (list (list 'disclose (first (last form))))) form)) :postprocess-value (lambda (item) - (if (of-state *apex-idiom* :disclose-output) + (if (of-state *april-idiom* :disclose-output) (list 'disclose item) item))) @@ -717,13 +717,13 @@ (? (has :titles ("Random" "Deal")) (ambivalent (args :scalar (lambda (omega) (+ (random omega) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (args :one :one (lambda (omega alpha) (make-array (list alpha) :initial-contents (loop for i from 0 to (1- alpha) collect (+ (random omega) - (of-state *apex-idiom* :count-from)))))))) + (of-state *april-idiom* :count-from)))))))) (○ (has :titles ("Pi Times" "Circular")) (ambivalent (args :scalar (lambda (omega) (* pi omega))) (args :any :one (lambda (omega alpha) @@ -833,9 +833,9 @@ (make-array (list omega) :initial-contents (alexandria:iota omega - :start (of-state *apex-idiom* :count-from))))) + :start (of-state *april-idiom* :count-from))))) (args :any :any (lambda (omega alpha) - (index-of omega alpha (of-state *apex-idiom* :count-from))))) + (index-of omega alpha (of-state *april-idiom* :count-from))))) (tests (is "⍳5" #(1 2 3 4 5)) (is "3⍳1 2 3 4 5" #(2 2 1 2 2)))) (⍴ (has :titles ("Shape" "Reshape")) @@ -856,13 +856,13 @@ collect nil))) (loop for index from 0 to (1- (length (first axes))) do (setf (nth (- (aref (first axes) index) - (of-state *apex-idiom* :count-from)) + (of-state *april-idiom* :count-from)) elided-coords) (- (aref alpha index) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (aref-eliding omega elided-coords)) (let* ((coords (mapcar (lambda (coord) (- coord - (of-state *apex-idiom* :count-from))) + (of-state *april-idiom* :count-from))) (array-to-list alpha))) (found (apply #'aref (cons omega coords)))) (if (not (arrayp found)) @@ -909,7 +909,7 @@ (multidim-slice omega (if axes (loop for axis from 0 to (1- (rank omega)) collect (if (= axis (- (aref (first axes) 0) - (of-state *apex-idiom* + (of-state *april-idiom* :count-from))) (aref alpha 0) (nth axis (dims omega)))) @@ -931,7 +931,7 @@ (multidim-slice omega (if axes (loop for axis from 0 to (1- (rank omega)) collect (if (= axis (- (aref (first axes) 0) - (of-state *apex-idiom* + (of-state *april-idiom* :count-from))) (aref alpha 0) 0)) @@ -947,7 +947,7 @@ (\, (has :titles ("Ravel" "Catenate or Laminate")) (ambivalent (args :any :axes (lambda (omega &optional axes) - (ravel (of-state *apex-idiom* :count-from) + (ravel (of-state *april-idiom* :count-from) omega axes))) (args :any :any :axes (lambda (omega alpha &optional axes) @@ -956,19 +956,19 @@ (vectorp alpha) (vectorp omega)) (if (and axes (< 0 (- (aref (first axes) 0) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (error (concatenate 'string "Specified axis is greater than 1, vectors" " have only one axis along which to catenate.")) (if (and axes (> 0 (- (aref (first axes) 0) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (error (format nil "Specified axis is less than ~a." - (of-state *apex-idiom* :count-from))) + (of-state *april-idiom* :count-from))) (concatenate 'vector alpha omega))) (if (or (not axes) (integerp (aref (first axes) 0))) (let* ((axis (if axes (- (aref (first axes) 0) - (of-state *apex-idiom* :count-from)) + (of-state *april-idiom* :count-from)) (1- (max (array-rank alpha) (array-rank omega))))) (scale-alpha (if (not (is-singleton alpha)) @@ -978,7 +978,7 @@ (aops:stack axis scale-alpha scale-omega)) ;; laminate in the case of a fractional axis argument (let* ((axis (ceiling (- (aref (first axes) 0) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (permute-dims (alexandria:iota (1+ (rank alpha)))) (p-alpha (if (not (is-singleton alpha)) (aops:permute (rotate-right axis permute-dims) @@ -1033,19 +1033,19 @@ (if (and (vectorp alpha) (vectorp omega)) (if (and axes (< 0 (- (aref (first axes) 0) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (error (concatenate 'string "Specified axis is greater than 1, vectors" " have only one axis along which to catenate.")) (if (and axes (> 0 (- (aref (first axes) 0) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (error (format nil "Specified axis is less than ~a." - (of-state *apex-idiom* :count-from))) + (of-state *april-idiom* :count-from))) (concatenate 'vector alpha omega))) (if (or (not axes) (integerp (aref (first axes) 0))) (let* ((axis (if axes (- (aref (first axes) 0) - (of-state *apex-idiom* :count-from)) + (of-state *april-idiom* :count-from)) 0)) (scale-alpha (if (not (is-singleton alpha)) alpha (scale-array alpha omega axis))) @@ -1068,7 +1068,7 @@ (expand-array (array-to-list alpha) omega (if axes (- (rank omega) (- (aref (first axes) 0) - (1- (of-state *apex-idiom* :count-from))))) + (1- (of-state *april-idiom* :count-from))))) 0 :compress-mode t)))) (tests (is "5/3" #(3 3 3 3 3)) (is "1 0 1 0 1/⍳5" #(1 3 5)) @@ -1085,7 +1085,7 @@ (expand-array (array-to-list alpha) omega (if axes (- (rank omega) (- (aref (first axes) 0) - (1- (of-state *apex-idiom* :count-from))))) + (1- (of-state *april-idiom* :count-from))))) (1- (rank omega)) :compress-mode t)))) (tests (is "1 0 1 0 1⌿⍳5" #(1 3 5)) @@ -1100,7 +1100,7 @@ (expand-array (array-to-list alpha) omega (if axes (- (rank omega) (- (aref (first axes) 0) - (1- (of-state *apex-idiom* :count-from))))) + (1- (of-state *april-idiom* :count-from))))) 0)))) (tests (is "1 ¯2 3 ¯4 5\\ '.'" ". ... .....") (is "1 ¯2 2 0 1\\3+2 3⍴⍳6" #2A((4 0 0 5 5 0 6) (7 0 0 8 8 0 9))) @@ -1111,7 +1111,7 @@ (expand-array (array-to-list alpha) omega (if axes (- (rank omega) (- (aref (first axes) 0) - (1- (of-state *apex-idiom* :count-from))))) + (1- (of-state *april-idiom* :count-from))))) (1- (rank omega)))))) (tests (is "1 ¯2 3 ¯4 5⍀3" #(3 0 0 3 3 3 0 0 0 0 3 3 3 3 3)) (is "1 0 1⍀3+2 3⍴⍳6" #2A((4 5 6) (0 0 0) (7 8 9))))) @@ -1120,7 +1120,7 @@ (lambda (omega &optional axes) (if axes (re-enclose omega (aops:each (lambda (axel) - (- axel (of-state *apex-idiom* :count-from))) + (- axel (of-state *april-idiom* :count-from))) (first axes))) (if (loop for dim in (dims omega) always (= 1 dim)) omega (make-array (list 1) :initial-element omega))))) @@ -1175,7 +1175,7 @@ (partitioned-enclose alpha omega (if axes (- (rank omega) (- (aref (first axes) 0) - (1- (of-state *apex-idiom* :count-from))))) + (1- (of-state *april-idiom* :count-from))))) 0)))) (tests (is "0 1 0 0 1 1 0 0 0⍧⍳9" #(#(2 3 4) #(5) #(6 7 8 9))) (is "0 1 0 0 1 1 0 0 0⍧4 8⍴⍳9" @@ -1188,14 +1188,14 @@ (lambda (omega &optional axes) (mix-arrays (if axes (ceiling (- (1+ (rank omega)) (aref (first axes) 0) - (of-state *apex-idiom* :count-from))) + (of-state *april-idiom* :count-from))) 0) omega))) (args :any :any (lambda (omega alpha) (labels ((layer-index (object indices) (if indices (layer-index (aref object (- (first indices) - (of-state *apex-idiom* + (of-state *april-idiom* :count-from))) (rest indices)) object))) @@ -1328,7 +1328,7 @@ omega))) (args :any :any (lambda (omega alpha) (aops:permute (mapcar (lambda (i) - (- i (of-state *apex-idiom* :count-from))) + (- i (of-state *april-idiom* :count-from))) (array-to-list alpha)) omega)))) (tests (is "⍉2 3 4⍴⍳9" #3A(((1 4) (5 8) (9 3)) ((2 5) (6 9) (1 4)) @@ -1358,37 +1358,37 @@ (is "35 89 79⌹3 3⍴3 1 4 1 5 9 2 6 5" #(193/90 739/90 229/45)) (is "(3 2⍴1 2 3 6 9 10)⌹3 3⍴1 0 0 1 1 0 1 1 1" #2A((1 2) (2 4) (6 4))))) (⍋ (has :titles ("Grade Up" "Grade Up By")) - (ambivalent (args :any (lambda (omega) (grade omega (alpha-compare (of-state *apex-idiom* + (ambivalent (args :any (lambda (omega) (grade omega (alpha-compare (of-state *april-idiom* :atomic-vector) #'<=) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (args :any :any (lambda (omega alpha) (grade (if (vectorp alpha) (index-of alpha omega - (of-state *apex-idiom* + (of-state *april-idiom* :count-from)) (array-grade alpha omega)) - (alpha-compare (of-state *apex-idiom* + (alpha-compare (of-state *april-idiom* :atomic-vector) #'<) - (of-state *apex-idiom* :count-from))))) + (of-state *april-idiom* :count-from))))) (tests (is "⍋8 3 4 9 1 5 2" #(5 7 2 3 6 1 4)) (is "⍋5 6⍴⍳16" #(1 4 2 5 3)) (is "st←'aodjeignwug' ◊ st[⍋st]" "adeggijnouw") (is "(2 5⍴'ABCDEabcde')⍋'ACaEed'" #(1 3 2 6 4 5)))) (⍒ (has :titles ("Grade Down" "Grade Down By")) - (ambivalent (args :any (lambda (omega) (grade omega (alpha-compare (of-state *apex-idiom* + (ambivalent (args :any (lambda (omega) (grade omega (alpha-compare (of-state *april-idiom* :atomic-vector) #'>=) - (of-state *apex-idiom* :count-from)))) + (of-state *april-idiom* :count-from)))) (args :any :any (lambda (omega alpha) (grade (if (vectorp alpha) (index-of alpha omega - (of-state *apex-idiom* + (of-state *april-idiom* :count-from)) (array-grade alpha omega)) - (alpha-compare (of-state *apex-idiom* + (alpha-compare (of-state *april-idiom* :atomic-vector) #'>) - (of-state *apex-idiom* :count-from))))) + (of-state *april-idiom* :count-from))))) (tests (is "⍒6 1 8 2 4 3 9" #(7 3 1 5 6 4 2)) (is "⍒5 6⍴⍳12" #(2 4 1 3 5)) (is "st←'aodjeignwug' ◊ st[⍒st]" "wuonjiggeda") @@ -1455,7 +1455,7 @@ (⍎ (has :title "Evaluate") (monadic (macro (lambda (meta axes omega) (declare (ignore meta axes)) - `(apex ,omega)))) + `(april ,omega)))) (tests (is "⍎'1+1'" 2))) (∘ (has :title "Find Outer Product, Not Inner") (symbolic :outer-product-designator))) diff --git a/lexicon.md b/lexicon.md index 680a4f2e..2add0a7a 100644 --- a/lexicon.md +++ b/lexicon.md @@ -1,6 +1,6 @@ -## Apex APL Lexicon +## April APL Lexicon @@ -134,4 +134,4 @@ [∘] Compose [⍣] Power -``` \ No newline at end of file +``` diff --git a/package.lisp b/package.lisp index 6ef5d2a3..30f9b736 100644 --- a/package.lisp +++ b/package.lisp @@ -1,7 +1,7 @@ ;;;; package.lisp -(defpackage #:apex - (:export #:apex) +(defpackage #:april + (:export #:april) (:use #:cl #:aplesque #:vex #:alexandria #:array-operations #:cl-ppcre #:parse-number #:symbol-munger #:prove) (:shadowing-import-from #:array-operations #:split #:flatten)) diff --git a/vex/vex.lisp b/vex/vex.lisp index bf1d4a44..ba4360b0 100644 --- a/vex/vex.lisp +++ b/vex/vex.lisp @@ -50,7 +50,6 @@ "Retrive one of the idiom's operators." (gethash key (idiom-operators idiom))) - (defgeneric of-overloaded? (idiom key)) (defmethod of-overloaded? ((idiom idiom) key) "Check whether the argument is part of the idiom's overloaded lexicon (glyphs that may be functions or operators)."