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

SwankR and multiple values #2

Open
phmarek opened this issue Nov 19, 2013 · 3 comments
Open

SwankR and multiple values #2

phmarek opened this issue Nov 19, 2013 · 3 comments

Comments

@phmarek
Copy link

phmarek commented Nov 19, 2013

Using swankr to evaluate 1\n2\n3\n results is 3 times (:write-string...) which will result in a REPL output of [1] 1[1] 2[1] 3.

Should swankr ignore intermediate values and only output the last, or should it do a newline inbetween?

@csrhodes
Copy link
Owner

Good question. How exactly are you evaluating that?

(Sorry for the late response -- Happy New Year!)

@phmarek
Copy link
Author

phmarek commented Jan 11, 2014

Well, I write the lines

1
2
3

in vim, and then mark and send them to swank:

000040(:emacs-rex (swank:listener-eval "1
2
3
") "R" :repl-thread 10)

I get a result

000024(:write-string "[1] 1" :repl-result)000024(:write-string "[1] 2" :repl-result)000024(:write-string "[1] 3" :repl-result)000015(:return (:ok ()) 10)

The "typical" swank in a CL puts a (progn) around, and so only returns the last result.

The output in the REPL looks like that:

[1] 1[1] 2[1] 3

Oh yes, happy new year to you, too!

@csrhodes
Copy link
Owner

phmarek notifications@github.com writes:

Well, I write the lines

1
2
3

in vim, and then mark and send them to swank:

000040(:emacs-rex (swank:listener-eval "1

Ah. In the analogous case I would use slime-eval-region, which wouldn't
call listener-eval.

If I absolutely force a listener-eval, by typing
1 C-j 2 C-j 3 RET into my emacs-based slime-repl R buffer, I get 1 2 3
printed back on separate lines (I've got slime-presentations loaded,
which probably enforces that). So I suspect that the right answer is to
mimic that and have newlines between the separate results.

("1 2 3" -- or the same but with newlines -- isn't actually very legal
R; I'm not sure what is actually causing it to be interpreted as three
separate statements, but wrapping it in an implicit progn -- a {} --
would lead to failure to eval).

Cheers,

Christophe

2
3
") "R" :repl-thread 10)

I get a result
```lisp
000024(:write-string "[1] 1" :repl-result)000024(:write-string "[1] 2"
:repl-result)000024(:write-string "[1] 3" :repl-result)000015(:return
(:ok ()) 10)

The "typical" swank in a CL puts a (progn) around, and so only
returns the last result.

The output in the REPL looks like that:

[1] 1[1] 2[1] 3

Reply to this email directly or view it on GitHub:
#2 (comment)

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