-
Is there a way to show a function's source code in the repl? Was goofing around directly in the repl (instead of sending from a file) and wanted to double check something. I tried using (describe myFunction), to see it returns "". I know this works in Common Lisp, and it looks like it works in Janet for variables, but is there a way to see a function's source in the repl? |
Beta Was this translation helpful? Give feedback.
Answered by
sogaiu
Apr 27, 2025
Replies: 2 comments 2 replies
-
AFAIK, there isn't a way to do this currently. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
lc9er
-
Very cool! Thanks for sharing this. Even without formatting, this is very
useful.
…On Fri, May 2, 2025 at 5:05 AM sogaiu ***@***.***> wrote:
I looked into this a bit more and discovered that starting janet with -d
leads to something like the source being retained:
$ janet -d
Janet 1.38.0-b27c830d linux/x64/gcc - '(doc)' for help
repl:1:> (defn a [x] (+ x 1))
<function a>
repl:2:> (get (dyn 'a) :source-form)
(defn a [x] (+ x 1))
I think what is accessible via :source-form is not a string though so no
formatting info is available IIUC.
—
Reply to this email directly, view it on GitHub
<#1592 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE2BFH6OVRKW5QCUQY3TJNT24MYNTAVCNFSM6AAAAAB356NCA6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMBRGE4TQMQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AFAIK, there isn't a way to do this currently.