Skip to content

Instantly share code, notes, and snippets.

@WetHat
Last active August 1, 2024 16:36
Show Gist options
  • Save WetHat/a49e6f2140b401a190d45d31e052af8f to your computer and use it in GitHub Desktop.
Save WetHat/a49e6f2140b401a190d45d31e052af8f to your computer and use it in GitHub Desktop.
Pretty Print Table Data in Common Lisp
Display the source blob
Display the rendered blob
Raw
Loading
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

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