Coder Social home page Coder Social logo

april's People

Contributors

christophejunke avatar egao1980 avatar faeredia avatar jaccarmac avatar josrr avatar justin2004 avatar mcparen avatar paulapatience avatar phantomics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

april's Issues

≡ with empty character vectors

dyalog

      '' ≡  ''
1
CL-USER> (april "''≡''")
Invalid index 0 for (VECTOR CHARACTER 0), should be a non-negative integer below 0

Incorrect grade on character array

On SBCL 1.5.6, on Linux 4.4.0/x86_64, with April 20191227 (from Quicklisp):

CL-USER> (ql:system-apropos "april")
#<SYSTEM aplesque / april-20191227-git / quicklisp 2019-12-27>
#<SYSTEM april / april-20191227-git / quicklisp 2019-12-27>
#<SYSTEM vex / april-20191227-git / quicklisp 2019-12-27>

CL-USER> (april:april "s←'abcABC012xyzXYZ789'⋄s[⍋s]")
"ABCXYZabcxyz012789"

Compare with Dyalog or GNU APL:

      s←'abcABC012xyzXYZ789'⋄s[⍋s]
012789ABCXYZabcxyz

(april:april (test)) is passing correctly, and numeric arrays are grading correctly:

CL-USER> (let ((s (map 'vector 'char-code "abcABC012xyzXYZ789")))
  (map 'string 'code-char
       (april:april (with (:state :in ((s s)))) "s[⍋s]")))
"012789ABCXYZabcxyz"

LispWorks listener: (april (test)) does not show everything in UTF-8

Example:

� Printed: Catenated character and numeric arrays.
  _ (⍪⍳3),(3 3⍴'abcdef'),(3 3⍴⍳9),(3 3⍴'defghi'),⍪⍳3
  � "1 abc 1 2 3 def 1
      2 def 4 5 6 ghi 2
      3 abc 7 8 9 def 3
      " is expected to be "1 abc 1 2 3 def 1
      2 def 4 5 6 ghi 2
      3 abc 7 8 9 def 3
      " 

Wrong output of Circular function

April:

(april:april-p` "
0 ¯1 ¯2 ¯6 ¯7 ∘.○ ¯2 ¯2J0
")
 2.236068              2.236068            
¯1.5707964J1.3169578  ¯1.5707964J1.3169578 
 3.1415927J¯1.3169578  3.1415927J¯1.3169578
 1.3169578J3.1415927   1.3169578J3.1415927 
¯0.54930615J1.5707964 ¯0.54930615J1.5707964
#2A((2.236068 2.236068)
    (#C(-1.5707964 1.3169578) #C(-1.5707964 1.3169578))
    (#C(3.1415927 -1.3169578) #C(3.1415927 -1.3169578))
    (#C(1.3169578 3.1415927) #C(1.3169578 3.1415927))
    (#C(-0.54930615 1.5707964) #C(-0.54930615 1.5707964)))

Some other APL:

      0 ¯1 ¯2 ¯6 ¯7 . ¯2 ¯2J0
 0.0000000000J01.732050808  0.0000000000J01.732050808
¯1.5707963270J01.316957897 ¯1.5707963270J01.316957897
 3.1415926540J¯1.316957897  3.1415926540J¯1.316957897
 1.3169578970J03.141592654  1.3169578970J03.141592654
¯0.5493061443J¯1.570796327 ¯0.5493061443J¯1.570796327

explicit vector precedence acts like enclose

in dyalog

      ⍴2↓5 6 7 8
2
      ⍴(2↓5 6 7 8)
2

so i would say that dyalog just treats the parens like precedence enforcement not enclosure.

but i think april is enclosing in the second expression

APRIL> (april "⍴2↓5 6 7 8")
#(2)
APRIL> (april "⍴(2↓5 6 7 8)")
#*1

membership -- mixed types and non-vector left arguments

dyalog is ok with mixed types

      5∊'other'
0
APRIL> (april "5∊'other'")
The value
  #\o
is not of type
  NUMBER

april handles a vector left argument but not a scalar left argument

APRIL> (april "'oz'∊'other'")
#*10 
APRIL> (april "'o'∊'other'")
The value
  #\o
is not of type
  NUMBER

while dyalog does

      'o'∊'other'
1

drop on a matrix (shortcut?)

APRIL> (april "m←3 4 ⍴ ⍳13 ⋄ 1 0↓m")
#2A((5 6 7 8) (9 10 11 12))

dyalog will do that too but dyalog will also do the same thing here (i don't know the name but it feels like a shortcut notation):

      m←3 4 ⍴ ⍳13 ⋄ 1↓ m
5  6  7  8
9 10 11 12

but april will not:

APRIL> (april "m←3 4 ⍴ ⍳13 ⋄ 1↓m") 
Incorrect number of dimensions to drop, 1, for input array of rank 2.
   [Condition of type SIMPLE-ERROR]

dyadic ⊂ behaves different than GNU APL

in gnu apl
1 1 2 2 ⊂ ⍳4
evaluates to 1 2 3 4 (a 2 item vector with the partition between the 2 and 3)

(april "⎕←1 1 2 2⊂⍳4")
also evaluates to a 2 item vector but the partition is between the 1 and 2: 1 2 3 4

also dyalog (https://tutorial.dyalog.com/) expects the former.

thanks for recommending dyalog's tutorial (in your video on april), by the way!

indexed assignment with multiple indices receiving a nested scalar

dyalog

      v← 1 ¯2 3 ¯4 ⋄ v[2 4]←⊂'negative' ⋄ v
1  negative  3  negative

and with numerics

      v← 1 ¯2 3 ¯4 ⋄ v[2 4]←⊂9 8 ⋄ v
1  9 8  3  9 8

april can handle it with a single assignment index

APRIL> (april "v← 1 ¯2 3 ¯4 ⋄ v[2]←⊂'negative' ⋄ v")
#(1 "negative" 3 -4)

but not with multiple assignment indices

APRIL> (april "v← 1 ¯2 3 ¯4 ⋄ v[2 4]←⊂'negative' ⋄ v")
When assigning from an array, the shape of the area to be assigned and the shape of the array to assign from must be the same.
   [Condition of type SIMPLE-ERROR

and i think april does the right thing here:

APRIL> (april "v← 1 ¯2 3 ¯4 ⋄ v[2]←⊂9 8 ⋄ v")
#(1 #(9 8) 3 -4)

but here it is as though april discards the fact that the thing to be received is a nested scalar and instead treats it as a simple vector:

APRIL> (april "v← 1 ¯2 3 ¯4 ⋄ v[2 4]←⊂9 8 ⋄ v")
#(1 9 3 8)

scalar extension with catenate not working on characters

(april "(2 2 ⍴ 5),6 6")
works as expected

(april "(2 2 ⍴ 5),6")
same result as the previous due to scalar (6) being extended, as expected

now with character data

(april "(2 2 ⍴ 'h'),'**' ")
works as expected

(april "(2 2 ⍴ 'h'),'*' ")
signals "Incompatible arrays."

axes/index precedence

this may be related to our discussion in #33

it seems like in april the index glyph(s) is binding harder than the spaces that hold vectors together.

in dyalog the spaces that hold vectors together seem to bind harder:

      5 6 7 8[2]
6
APRIL> (april "5 6 7 8[2]")
Axes cannot be applied to numbers

enclose does not always work on simple character scalars

it works on character vectors

CL-USER> (april-p "⊂'hi'")
 hi 
#("hi")

but not with a simple scalar (that is a character).

CL-USER> (april-p "⊂'h'")
The value
  #\h
is not of type
  NUMBER
when binding SB-KERNEL::X
   [Condition of type TYPE-ERROR

in dyalog

⊂'v'='v'

evaluates to 1. so enclose on a simple scalar is like an identity function.

but interestingly april does the right thing here:

CL-USER> (april-p "⊂'h'='h'")
1
1

APRIL-P attempts to print assignment statement value

APL interpreters tend not to print value of assignment. In april's case assignment returns value and lambdas are not supported by the printing code. Here's an example.

(april:april-p "
f ← {⍵ + 3 5}
")

Results in:

The value
  #<FUNCTION (LAMBDA (APRIL::⍵ &OPTIONAL APRIL::⍺)) {52F334CB}>
is not of type
  NUMBER
when binding SB-KERNEL::X
   [Condition of type TYPE-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1002F18413}>)

Backtrace:
  0: (SB-KERNEL:TWO-ARG-< #<FUNCTION (LAMBDA (APRIL::⍵ &OPTIONAL APRIL::⍺)) {52F334CB}> 0) [external]
  1: (SB-VM::GENERIC-<)
  2: (APRIL::PRINT-APL-NUMBER-STRING #<FUNCTION (LAMBDA (APRIL::⍵ &OPTIONAL APRIL::⍺)) {52F334CB}> T 10 NIL)
  3: ((LAMBDA ()))

index discloses when it should not?

in dyalog the index function extracts the nested scalar 'bobby' but it does not disclose it (since its shape is an empty vector).

      bob ← 1 'bobby' (2 4) ⋄ ⍴bob[2]

if you want it disclosed you have to do it explicitly

      bob ← 1 'bobby' (2 4) ⋄ ⍴⊃bob[2]
5

but april discloses the indexed scalar too

APRIL> (april "bob←1 'bobby' (2 4) ⋄ ⍴bob[2]")
#(5)

1 take on a vector

in dyalog 1 take on a vector evaluates to a vector

      ⍴1↑3 4 5
1

but in april it evaluates to a scalar

APRIL> (april "⍴1↑3 4 5")
#()

partitioned enclose doesn't scalar extend

i don't think this is a migration level situation but i may be wrong about that.

in april

CL-USER> (april "1⊂⍳10")
#(#(1 2 3 4 5 6 7 8 9 10))
CL-USER> (april "⍴1⊂⍳10")
#*1

in dyalog

      1⊂ ⍳10
 1  2  3  4  5  6  7  8  9  10 
      ⍴1⊂ ⍳10
10

so dyalog scalar extends the 1 to evaluate to a 10 item vector

Character comparison issue

(april:april "
elimSp ← {(⍵≠(≢⍵)⍴' ')/⍵}
⎕ ← elimSp 'hi there'
")

Stack trace:

The value
  #\h
is not of type
  NUMBER
when binding SB-KERNEL::X
   [Condition of type TYPE-ERROR]

Restarts:
 0: [RETRY] Retry SLY mREPL evaluation request.
 1: [*ABORT] Return to SLY's top level.
 2: [ABORT] abort thread (#<THREAD "sly-channel-1-mrepl-remote-1" RUNNING {1003A12683}>)

Backtrace:
 0: (SB-KERNEL:TWO-ARG-= #\h #\ ) [external]
 1: (SB-VM::GENERIC-=)
 2: ((LAMBDA (#:G5 &OPTIONAL #:G6)) #\  #\h)
      Locals:
        #:G5 = #\ 
        #:G6 = #\h
 3: ((LAMBDA (APLESQUE::ELEM APLESQUE::COORDS) :IN APLESQUE:EACH-BOOLEAN) #\  (0))
      Locals:
        APLESQUE::COORDS = (0)
        APLESQUE::ELEM = #\ 
 4: (APLESQUE:ACROSS "        " #<CLOSURE (LAMBDA (APLESQUE::ELEM APLESQUE::COORDS) :IN APLESQUE:EACH-BOOLEAN) {10012ABF1B}> :ELEMENTS NIL :INDICES NIL :REVERSE-AXES NIL :DIMENSIONS NIL)
      Locals:
        #:.DEFAULTING-TEMP. = NIL
        #:.DEFAULTING-TEMP.#1 = NIL
        DIMENSIONS = (8)
        FUNCTION = #<CLOSURE (LAMBDA (APLESQUE::ELEM APLESQUE::COORDS) :IN APLESQUE:EACH-BOOLEAN) {10012ABF1B}>
        INDICES = NIL
        INPUT = "        "
        #:N-SUPPLIED-0 = 0
        PROCEEDING = T
        REVERSE-AXES = NIL
 5: (APLESQUE:EACH-BOOLEAN #<CLOSURE (LAMBDA (APRIL::ELEM APRIL::COORDS) :IN APRIL::APPLY-SCALAR) {10012ABEBB}> "        ")
      Locals:
        OMEGA = "        "
        TEST = #<CLOSURE (LAMBDA (APRIL::ELEM APRIL::COORDS) :IN APRIL::APPLY-SCALAR) {10012ABEBB}>
 6: ((LAMBDA (APRIL::⍵ &OPTIONAL APRIL::⍺)) "hi there" #<unused argument>)
      Locals:
        APRIL::⍵ = "hi there"
 7: ((LAMBDA ()))
 8: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LET* ((APRIL::OUTPUT-STREAM *STANDARD-OUTPUT*) (APRIL::INDEX-ORIGIN 1) (APRIL::PRINT-PRECISION 10) (#1=#:A829 :UNDEFINED)) (DECLARE (IGNORABLE APRIL::OUTPUT-STREAM APRIL..
 9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (APRIL:APRIL " ..)
10: (EVAL (APRIL:APRIL " ..)

Running in SBCL:

CL-USER> (lisp-implementation-type)
"SBCL"
CL-USER> (lisp-implementation-version)
"1.4.16"

Still broken in SBCL 2.0.2.

Minor: Reformat the code / use automatic formatter

Could we please use spaces in formatting?

I'll look into providing automatic code formatting command to make code look consistent for all contributors. MOst likely it would be CLI emacs batch run :)

index function on matrix is sensitive to spaces

might not be a big deal but april is sensitive to spaces inside the index function when applied to a matrix.

no problem:

APRIL> (april-f "m←3 4 ⍴ ⍳13 ⋄ m[;4 3]")
 4  3
 8  7
12 11
#2A((4 3) (8 7) (12 11)

but with a space:

APRIL> (april-f "m←3 4 ⍴ ⍳13 ⋄ m[ ;4 3]")
Invalid index 0 for (SIMPLE-VECTOR 0), should be a non-negative integer below 0.
   [Condition of type SB-INT:INVALID-ARRAY-INDEX-ERROR]

while dyalog doesn't care about the space:

      m←3 4 ⍴ ⍳13 ⋄ m[;4 3]
 4  3
 8  7
12 11
      m←3 4 ⍴ ⍳13 ⋄ m[ ;4 3]
 4  3
 8  7
12 11

pick an item from a matrix

in dyalog you can as long as you enclose the left arguments

      m←3 4 ⍴ ⍳13 ⋄ (⊂2 2)⊃m
6
APRIL> (april "m←3 4 ⍴ ⍳13 ⋄ (⊂2 2)⊃m")
The value
  #(2 2)
is not of type
  NUMBER

possibility to compile to javascript?

not really an issue, but a question.

Really interesting project. I see you also do projects in parenscript. I am not very familiar with the common lisp ecosystem (or limitations), is it theoretically possible to output the compiled lisp as javascript using parenscript?

monadic rho on nested scalars

this looks sensible

CL-USER> (april "⊂1 2 3")
#(#(1 2 3))
CL-USER> (april "⍴⊂1 2 3")
1

but gnu apl and dyalog treat ⊂1 2 3 as a scalar with respect to monadic rho.
e.g.

      (⊂1 2 3)
 1 2 3 
      ⍴(⊂1 2 3)

that is, the last expression does not evaluate to 1 it evaluates to the empty vector just like ⍴4 evaluates to the empty vector.

Scalar function with Each operator doesn't work for arrays in alpha and omega

CL-USER> (april:april-c "(3 3⍴⊂3 3⍴⍳9)ר(3 3⍴⍳9)")
; Debugger entered on #<TYPE-ERROR expected-type: SEQUENCE
;              datum: #<(SIMPLE-ARRAY T (3 3)) {1004D4671F}>>

The value
  #2A((#1=#2A((1 2 3) (4 5 6) (7 8 9)) #1# #1#)
      (#1# #1# #1#)
      (#1# #1# #1#))

is not of type
  SEQUENCE
   [Condition of type TYPE-ERROR]

Expected:

 (3 33 39)ר(3 39)
 1 2 3      2  4  6   3  6  9 
 4 5 6      8 10 12  12 15 18 
 7 8 9     14 16 18  21 24 27 
  4  8 12   5 10 15   6 12 18 
 16 20 24  20 25 30  24 30 36 
 28 32 36  35 40 45  42 48 54 
  7 14 21   8 16 24   9 18 27 
 28 35 42  32 40 48  36 45 54 
 49 56 63  56 64 72  63 72 81 

index function on a matrix is too lenient?

april gets the first row without the ';'

APRIL> (april "⎕←m←3 4 ⍴ ⍳13 ⋄ m[1]")
1  2  3  4
5  6  7  8
9 10 11 12
#(1 2 3 4)

but dyalog requires ';'

      m←3 4 ⍴ ⍳13 ⋄ m[1]
RANK ERROR
      m←3 4⍴⍳13 ⋄ m[1]
                   ∧
      m←3 4 ⍴ ⍳13 ⋄ m[1;]
1 2 3 4

strand assignment doesn't scalar extend

in dyalog:

      (a b c) ← 10
      a
10
      b
10
      c
10

and it works for even nested scalars:

      (a b c) ← ⊂(3 3 ⍴  0)
      a
0 0 0
0 0 0
0 0 0
      b
0 0 0
0 0 0
0 0 0
      c
0 0 0
0 0 0
0 0 0
CL-USER> (april "(a b c) ← 10")
Value of #:A2 in (LENGTH #:A2) is 10, not a SEQUENCE

take on a matrix

APRIL> (april-f "m←3 4 ⍴ ⍳20 ⋄ 2 ¯3↑m")
2 3 3
6 7 7
#2A((2 3 3) (6 7 7))

but shouldn't it evaluate to

#2A((2 3 4) (6 7 8))

indexing when nested scalars are involved

dyalog

      (1 2 3 4) 15[1]
 1 2 3 4

when i looked at the marco expansion of this

APRIL> (april "(1 2 3 4) 15[1]")
#(#0A#(1 2 3 4) 15)

it was the same expansion as

(april "(1 2 3 4) 15")

drop has a blind spot on character vectors

CL-USER> (april-p "1↓'ABCD'")
BCD
"BCD"
CL-USER> (april-p "1↓'ABC'")
BC
"BC"
CL-USER> (april-p "1↓'AB'")
The value
  #\B
is not of type
  NUMBER
CL-USER> (april-p "1↓'A'")
""

April fails to print complex arrays (both 1-d and 2-d)

The code that aligns numbers by decimal dot assumes that (numberp ...) is comparable with 0 - not the case for complex numbers.

Quick fix - use (realpart elem) and (realpart original) in the relevant parts of ARRAY-IMPRESS

reduce and scalars

i haven't systematically found all all the functions that do this too but it looks like quite a few of them. here are a couple examples:

APRIL> (april "+/0")
The value
  -1
is not of type
  UNSIGNED-BYTE
      +/0
0
APRIL> (april "⌈/3")
The value
  -1
is not of type
  UNSIGNED-BYTE
      ⌈/3
3

printer trouble

2 examples

CL-USER> (april-f "⊂1 2 3")
The value        
  NIL            
is not of type               
  NUMBER
CL-USER> (april-f "(⊂'cat') ∊ 'cat' 'mat'")
The value
  NIL
is not of type
  NUMBER

padding item -- type and shape

it looks like dyalog looks at the first vector item to determine what to pad with (its type and shape):

      v←'3' 2 1 ⋄ (4↑v)
3 2 1  
      v←('happy') 2 1 ⋄ (4↑v),'end'
 happy  2 1        end
      v← (1 2 3) 8 9 ⋄ (4↑v)
 1 2 3  8 9  0 0 0 
      v← (3 4 ⍴ ⍳13) 8 9 ⋄ (4↑v)
 1  2  3  4  8 9  0 0 0 0 
 5  6  7  8       0 0 0 0 
 9 10 11 12       0 0 0 0

while april always pads with a numeric scalar:

APRIL> (april-f "v← (3 4 ⍴ ⍳13) 8 9 ⋄ (4↑v)")
 1  2  3  4  8 9 0
 5  6  7  8
 9 10 11 12
#(#2A((1 2 3 4) (5 6 7 8) (9 10 11 12)) 8 9 0)

Excessive consing during reduction over axis

I'm trying April as a tool for image processing. I understand that currently performance is not the main focus but I think it would be nice to have.

Loading image:

OPTICL-OCR> (defparameter *img* (opticl:read-png-file #p"tests/data/in.png"))
*IMG*

As an array of unsigned bytes:

#<(SIMPLE-ARRAY (UNSIGNED-BYTE 8) (2485 3500 3)) {10080C7D2F}>
--------------------
Dimensions: (2485 3500 3)
...

And then converting it to grayscale (upto / 3):

OPTICL-OCR> (ql:quickload :april)
To load "april":
  Load 1 ASDF system:
    april
; Loading "april"
..
Specified idiom 「APRIL」 with 3 basic grammar elements, 4 opening grammar patterns, 7 following grammar patterns, 97 lexical functions, 14 lexical operators, 14 utility functions and 485 unit tests.

(:APRIL)
OPTICL-OCR> (time (april:april (with (:state :in ((a *img*))))
                               "+/[3] a"))
Evaluation took:
  8.437 seconds of real time
  8.437500 seconds of total run time (8.218750 user, 0.218750 system)
  [ Run times consist of 0.657 seconds GC time, and 7.781 seconds non-GC time. ]
  100.01% CPU
  23 lambdas converted
  28,678,250,025 processor cycles
  7,533,410,064 bytes consed

Consing 7Gb while only 8.6Mb is needed in ideal case.

take assignment and drop assignment are not implemented

that may be intentional so this might not be an issue?

in dyalog, first with scalar extension then without:

      v← 1 2 3 4 ⋄ (2↓v)←8 ⋄ v 
1 2 8 8
      v← 1 2 3 4 ⋄ (2↓v)←8 9 ⋄ v 
1 2 8 9

the same applies to take assignment

not exactly an issue -- just a discussion point

hey, have you seen https://github.com/cbaggers/varjo ?

Varjo is a Lisp to GLSL compiler.

i know you said in your video on april that sending data over to the gpu is some overhead that probably makes doing so not worth it. but i am just curious what you think about the feasibility of using varjo on the lisp that april writes.

also, since this probably isn't the best place for discussion... do you have a place where we can discuss april in the open?

drop with a vector as the left argument

im not sure what is happening here but since the behavior differs from dyalog i thought i'd run it by you.

in dyalog:

      AMTS←2 5 ⋄ AMTS↓AMTS
RANK ERROR
      AMTS←2 5 ⋄ AMTS↓AMTS
      AMTS←2.0 5 ⋄ AMTS↓AMTS
RANK ERROR
      AMTS←2 5 ⋄ AMTS↓AMTS
APRIL> (april "AMTS←2 5 ⋄ AMTS↓AMTS")
#()
APRIL> (april "AMTS←2.0 5 ⋄ AMTS↓AMTS")
The value
  0.0
is not of type
  SB-INT:INDEX

escaping `'` in string?

CL-USER> (april:april "'''T'")
NIL
CL-USER> (april:april "''T'")
"'T"
CL-USER> (april:april "'''")
#\'
CL-USER> (april:april "''''")
NIL
CL-USER> (april:april "\"''\"")
"''"
CL-USER> (april:april "'\\''")
"\\'"

This behavior is different from what we get from traditional APL.

(april (test)) : UNBOUND-VARIABLE OUT-STR

; in: APRIL:APRIL (TEST)
; (APRIL:APRIL-P
; "a←1 2 3 ⋄ ⎕ost←'OUT-STR' ⋄ ⎕←a+5 ⋄ ⎕←3 4 5 ⋄ ⎕ost←'OTHER-OUT-STR' ⋄ 3+a")
; --> APRIL:APRIL PROGN LET* APRIL::APL-ASSIGN SETQ
; ==>
; (THE T OTHER-OUT-STR)
;
; caught WARNING:
; undefined variable: OTHER-OUT-STR

; ==>
; (THE T OUT-STR)
;
; caught WARNING:
; undefined variable: OUT-STR
;
; compilation unit finished
; Undefined variables:
; OTHER-OUT-STR OUT-STR
; caught 2 WARNING conditions
#########
#<UNBOUND-VARIABLE OUT-STR {1004557073}>
#########

strand/vector assignment might not be implemented

(april "(a b c)←1 2 3")
signals an error: (𝕊|a| 𝕊|b| 𝕊|c|) is not a string designator

but in gnu apl and in the dyalog tutorial the vector 1 2 3 is destructured item-wise into a b and c.

compress (with a negative argument and scalar extension) on a matrix

compress with positive scalar extension works:

APRIL> (april-f "m←3 4 ⍴ ⍳17 ⋄ 2 / m ")
1 1  2  2  3  3  4  4
5 5  6  6  7  7  8  8
9 9 10 10 11 11 12 12
#2A((1 1 2 2 3 3 4 4) (5 5 6 6 7 7 8 8) (9 9 10 10 11 11 12 12))

compress with negative arguments (and no scalar extension) works:

APRIL> (april-f "m←3 4 ⍴ ⍳17 ⋄ ¯1 1 1 ¯1 / m ")
0  2  3 0
0  6  7 0
0 10 11 0
#2A((0 2 3 0) (0 6 7 0) (0 10 11 0))

but not negative argument with scalar extension:

APRIL> (april-f "m←4 4 ⍴ ⍳17 ⋄ ¯1 / m ")
The value
  -4 
is not of type
  SB-INT:INDEX

dyalog:

      m←3 4 ⍴ ⍳13 ⋄ ¯1 / m
0 0 0 0
0 0 0 0
0 0 0 0

Missing axes support for scalar dyadic operators

 (2 35)+[2] 1 2 3
6 7 8
6 7 8

In April:

CL-USER> (april:april-c " (2 3⍴5)+[2] 1 2 3")
; Debugger entered on #<SIMPLE-ERROR "Array size mismatch." {100542F6A3}>

The fix should be relatively straightforward by changing apply-scalar signature to (defun apply-scalar (function alpha &optional omega axes is-boolean) ...) and supporting application along the axis.

empty numeric vector (Zilde) and catenate

(april "⍬,4 5")
evaluates to the vector 0 4 5 but in gnu apl and dyalog it evaluates to the vector 4 5

in gnu apl and dyalog
⍬,4
evaluates to the vector 4 since ⍬is an empty vector
but april signals that nil is not of type number.

but it looks like you can get something that works like zilde should with:

CL-USER> (april "(1↓0)")
#*
CL-USER> (april "(1↓0),4")
#(4)
CL-USER> (april "(1↓0),4 5")
#(4 5)

index function (with empty vector arguments) on matrix

dyalog allows empty vector arguments in the index function

      OTHER←3 4 ⍴ ⍳13 ⋄ ⍴OTHER[⍬;]         
0 4
      OTHER←3 4 ⍴ ⍳13 ⋄ OTHER[⍬;]         
      

same behavior for empty character vectors:

      OTHER←3 4 ⍴ ⍳13 ⋄ OTHER['';]         
 
APRIL> (april "OTHER←3 4⍴⍳13 ⋄ OTHER[⍬;]")
Invalid index 0 for (SIMPLE-VECTOR 0), should be a non-negative integer below 0.
   [Condition of type SB-INT:INVALID-ARRAY-INDEX-ERROR

over taking a matrix with negative arguments (on the left)

april over takes when you give positive arguments (on the left) and pads with zeros, as expected.

but it doesn't over take when you give negative arguments:

APRIL> (april-f "m←3 4 ⍴ ⍳20 ⋄ 2 ¯5↑m")
Invalid index 4 for axis 1 of (SIMPLE-ARRAY (UNSIGNED-BYTE 7)
                               (3 4)), should be a non-negative integer below 4

dyalog:

      m←3 4 ⍴ ⍳20 ⋄ 2 ¯5↑m
0 1 2 3 4
0 5 6 7 8

Empty array dimension issue

(april:april-p "
elimSp ← {(⍵≠(≢⍵)⍴' ')/⍵}
anagram ← { a ← elimSp ⍺ ⋄ w ← elimSp ⍵ ⋄ ((⍴a)=⍴w) ∧ ∧/(+/a ∘.= w) = +/a ∘.= a }
⎕ ← ' ' anagram 'dog'
0") 

Please note that single space string that is going to be stripped to become empty string and cause error. Checked that TryAPL.org handles this case fine.

The value of ARRAY-OPERATIONS/DISPLACING::DIMENSION is 0, which is not of type (INTEGER
                                                                                1).
   [Condition of type SIMPLE-TYPE-ERROR]

Restarts:
 0: [STORE-VALUE] Supply a new value for ARRAY-OPERATIONS/DISPLACING::DIMENSION.
 1: [RETRY] Retry SLIME REPL evaluation request.
 2: [*ABORT] Return to SLIME's top level.
 3: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1002D90413}>)

Backtrace:
  0: (SB-KERNEL:CHECK-TYPE-ERROR ARRAY-OPERATIONS/DISPLACING::DIMENSION 0 (INTEGER 1) NIL)
  1: (ARRAY-OPERATIONS/DISPLACING:FILL-IN-DIMENSIONS (0 0) 0)
  2: (ARRAY-OPERATIONS/DISPLACING:RESHAPE #2A() (0 0) 0)
  3: (ARRAY-OPERATIONS/TRANSFORMING:OUTER* T #<FUNCTION (LAMBDA (#:G50 #:G49)) {52F0861B}> "" "")
  4: ((LAMBDA (APRIL::⍵ &OPTIONAL APRIL::⍺)) "dog" " ")
  5: ((LAMBDA ()))
  6: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LET* ((APRIL::OUTPUT-STREAM *STANDARD-OUTPUT*) (APRIL::INDEX-ORIGIN 1) (APRIL::P....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.