Earlier quoted context omitted.
> Dyalog APL's source code is about 500KLOC according to Dyalog's staff. GNU APL is over 100KLOC per its homepage. April's .lisp files currently stand at 6350LOC. What accounts for this discrepancy?
-Common Lisp vs C/C++ -April implements the language and just punts to CL for all the I/O and system level stuff. Like it doesn't have to implement a REPL, or a line editor or APL workspace files/array stores.
April, an APL Compiler for Common Lisp [video]
11–20 of 24 posts
Re: April, an APL Compiler for Common Lisp [video]
#12Earlier quoted context omitted.
April is usable within Common Lisp. When writing a CL program, you can invoke APL code on arrays. For example: (april-c "{⍴∪,(3⍴2*8)⊥3 1 2⍉⍵}" (opticl:read-png-file "/path/to/image.png")) This snippet uses the opticl library to load a PNG file, and then uses April to count the number of unique colors in the image. Consider the amount of code this would take in CL.
It would be cool if it was implemented as a reader macro instead of just passing a string to a function.
(defun april-reader (stream char)
(declare (ignore char))
`(april ,(read stream t nil t)))
(set-macro-character #\⎕ #'april-reader)Re: April, an APL Compiler for Common Lisp [video]
#13Earlier quoted context omitted.
-Common Lisp vs C/C++ -April implements the language and just punts to CL for all the I/O and system level stuff. Like it doesn't have to implement a REPL, or a line editor or APL workspace files/array stores.
Thanks. I'm guessing (based on my knowledge of J and all its optimizations/special forms) that Dyalog APL would still be more performant too? I didn't see it mentioned on the GH README.
Re: April, an APL Compiler for Common Lisp [video]
#14Since the video's quite long, here are some basics on April. Repo: https://github.com/phantomics/april April compiles APL to Common Lisp. It has almost all of the lexical functions and operators featured in Dyalog APL, the leading commercial APL interpreter and the most featureful APL implementation. It has many more features than the FOSS GNU APL, which is based on the old IBM APL2. Dyalog APL's source code is about…
> Dyalog APL's source code is about 500KLOC according to Dyalog's staff. GNU APL is over 100KLOC per its homepage. April's .lisp files currently stand at 6350LOC. What accounts for this discrepancy?
By working on multidimensional arrays, APL expands the range of computations that are accessible to optimization. I think the writer of a scalar compiler like C would generally be happy making a single loop as fast as possible. APL immediately makes the implementer think about what happens if there are many axes (each of which is equivalent to a nested loop) even if the later axes (inner loops) are small.
Re: April, an APL Compiler for Common Lisp [video]
#15Earlier quoted context omitted.
It would be cool if it was implemented as a reader macro instead of just passing a string to a function.
Do it yourself! (Implementation loosely based on phantomics' comment below.) (defun april-reader (stream char) (declare (ignore char)) `(april ,(read stream t nil t))) (set-macro-character #\⎕ #'april-reader)
(april "apl code") ; and april-f
(april (with (stuff)) "apl code") ; and april-f
(april-c "apl code" (input))
(april-c (with (stuff)) "apl code" (input))Re: April, an APL Compiler for Common Lisp [video]
#16Earlier quoted context omitted.
Do it yourself! (Implementation loosely based on phantomics' comment below.) (defun april-reader (stream char) (declare (ignore char)) `(april ,(read stream t nil t))) (set-macro-character #\⎕ #'april-reader)
You're probably gonna want something more complicated than that. Glancing at the github page it looks like at least the following need to be dealt with: (april "apl code") ; and april-f (april (with (stuff)) "apl code") ; and april-f (april-c "apl code" (input)) (april-c (with (stuff)) "apl code" (input))
Re: April, an APL Compiler for Common Lisp [video]
#17Earlier quoted context omitted.
April is usable within Common Lisp. When writing a CL program, you can invoke APL code on arrays. For example: (april-c "{⍴∪,(3⍴2*8)⊥3 1 2⍉⍵}" (opticl:read-png-file "/path/to/image.png")) This snippet uses the opticl library to load a PNG file, and then uses April to count the number of unique colors in the image. Consider the amount of code this would take in CL.
It would be cool if it was implemented as a reader macro instead of just passing a string to a function.
(april-load #P"/path/to/code.apl")
Then you can have files of pure APL code with no Lisp hanging around.
Re: April, an APL Compiler for Common Lisp [video]
#18Without watching the video, can we guess correctly that "for Common Lisp" means "in Common Lisp"? Or is it really meant for use within Common Lisp programs?
April is usable within Common Lisp. When writing a CL program, you can invoke APL code on arrays. For example: (april-c "{⍴∪,(3⍴2*8)⊥3 1 2⍉⍵}" (opticl:read-png-file "/path/to/image.png")) This snippet uses the opticl library to load a PNG file, and then uses April to count the number of unique colors in the image. Consider the amount of code this would take in CL.
I don't really read APL - but isn't this just a map/reduce over the pixels? - maybe (length (remove-duplicates 'pixel-data)) or some such?
Re: April, an APL Compiler for Common Lisp [video]
#19Earlier quoted context omitted.
April is usable within Common Lisp. When writing a CL program, you can invoke APL code on arrays. For example: (april-c "{⍴∪,(3⍴2*8)⊥3 1 2⍉⍵}" (opticl:read-png-file "/path/to/image.png")) This snippet uses the opticl library to load a PNG file, and then uses April to count the number of unique colors in the image. Consider the amount of code this would take in CL.
> Consider the amount of code this would take in CL. I don't really read APL - but isn't this just a map/reduce over the pixels? - maybe (length (remove-duplicates 'pixel-data)) or some such?
Re: April, an APL Compiler for Common Lisp [video]
#20Arrays > lists, just ask your CPU's D$.