Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pretty Print Table Data in Common Lisp
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lispm
Copy link

lispm commented Feb 22, 2020

You can get rid of APPLY:

CL-USER 70 > (apply #'nconc (mapcar (lambda (w s) (list w s)) '(1 2 3 4) '(a b c d)))
(1 A 2 B 3 C 4 D)

CL-USER 71 > (apply #'nconc (mapcar #'list '(1 2 3 4) '(a b c d)))
(1 A 2 B 3 C 4 D)

CL-USER 72 > (mapcan #'list '(1 2 3 4) '(a b c d))
(1 A 2 B 3 C 4 D)

@WetHat
Copy link
Author

WetHat commented Feb 22, 2020

Very good catch lispm! Your input is very much appreciated!

@Symbolics
Copy link

Symbolics commented Apr 8, 2021

This is great. I am about finished with table formatting functions for use with the pretty printer and thought about a markdown/restructured text version. Glad I found this. Perhaps these two could be combined into a project, say, "formatted-tables" ? My stuff is under the MS-PL. What's the license for this?

@WetHat
Copy link
Author

WetHat commented Apr 8, 2021

@Symbolics, the code has no usage restrictions. Use it as you see fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment