Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we capture a function output ? #1

Open
vindarel opened this issue Sep 24, 2019 · 10 comments
Open

Can we capture a function output ? #1

vindarel opened this issue Sep 24, 2019 · 10 comments

Comments

@vindarel
Copy link
Contributor

Hi,

Is it possible (or the goal) in erudite to capture and print the output of a function, akin to org mode ?

I'm imagining:

#| The latest news are:

@capture
#|
(defun latest-news ()
  (…))
(latest-news)

Regards

@mmontone
Copy link
Owner

Nope :(

@mmontone
Copy link
Owner

This would cool to have. Add some special Erudite section tag, and connect to a Swank instance to evaluate the code and then print it.

@mmontone
Copy link
Owner

I've started to implement code evaluation.

It is incomplete and needs refinement at the moment, but I will work on it in the next days.

Look at the @eval section.

@vindarel

a4bd593

@mmontone
Copy link
Owner

Hi,

Is it possible (or the goal) in erudite to capture and print the output of a function, akin to org mode ?

I'm imagining:

#| The latest news are:

@capture
#|
(defun latest-news ()
  (…))
(latest-news)

Regards

So, now, the answer to this question is, yes!

@mmontone
Copy link
Owner

TODO:

  • Implement a @local-eval tag that doesn't need to connect to a SWANK instance, and just evaluates code in the current Erudite image?
  • @code-and-eval tag, that prints code, and then prints the code evaluation result.
  • @code-and-local-eval ?
  • Add SWANK connection settings parameters to CLI and also ERUDITE function.
  • Improve evaluated code output format.

@vindarel
Copy link
Contributor Author

That's great!

@vindarel
Copy link
Contributor Author

Can you give the steps on how to setup this? By default, in the REPL, it didn't work. I tried setting erudite::*swank-port* to the current one, I tried creating a new swank server and telling erudite its port, but then the erudite:erudite command hangs. Do we have to set erudite::*swank-connection* manually? Thanks.

@mmontone
Copy link
Owner

You need to start a SWANK server with (SWANK:CREATE-SERVER :DONT-CLOSE T).

Please pull from this repo, as I've improved the error message.

Expect changes going forward; this is work in progress.

@vindarel
Copy link
Contributor Author

vindarel commented Mar 16, 2020

OK got it. It was just a bad usage. I was trying this:

;; @eval
;; some comment
(+ 1 1)
;; @end eval

and the call to slime-eval was hanging,

where we need

;; @eval
;; (+ 1 1)
;; @end eval

or the same inside "#|".

@mmontone
Copy link
Owner

Ok. I wish it didn't hang, and signal an error instead. I'll look into that later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants