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

Loading files do not return value of last expression #12

Open
siraben opened this issue Feb 27, 2018 · 2 comments
Open

Loading files do not return value of last expression #12

siraben opened this issue Feb 27, 2018 · 2 comments

Comments

@siraben
Copy link

siraben commented Feb 27, 2018

Create a new file with the following contents:

(define (fact n)
  (cond ((= n 0) 1) (else (* n (fact (- n 1))))))

'test-loaded

Loading this file in the scratch buffer produces:

(load "test.scm")
#<function>

The expected behavior is

(load "test.scm")
'test-loaded
@hughbarney
Copy link
Collaborator

The behaviour is specific to FemtoLisp which is the Lisp Implementation that is bound
to FemtoEmacs. The exact behaviour in an Emacs type editor depends on the Lisp or Scheme
implementation that is used.

GNU Emacs does the following:
(load "~/src/femto/examples/square.el") t

I think there could be a problem in FemtoEmacs in capturing the return value from load. What is returned is the string #.

(define retval (load "/home/hugh/src/Femto-Emacs/samples/square.scm"))
#

When working with FemtoLisp I found the code too complex and undocumented to follow. So I ended up
switching to a simpler Lisp implementation.

Femto does the following:
(load "/home/hugh/src/femto/examples/square.el")
#<Lambda (n)>
t

@hughbarney
Copy link
Collaborator

I am only maintaining the femto codebase at:

https://github.com/hughbarney/femto

Just tested to see if I get the same output in the scratch buffer to when I load from a file.

From lisp interaction in the scratch buffer you get:
<Lambda (n)>

If you load from a file you get
<Lambda (n)>

There is a similar example in the README file at:
https://github.com/hughbarney/femto/blob/master/README.md

I think your expectation here is that the evaluation should evaluate to the quoted value at the end of the file.
In Femto we dont have a quoting syntax for the lisp if I rember rightly.

Note that neither Femto for FemtoEmacs are supporting scheme. Both are supporting variants of Lisp that might lok like scheme.

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