FemtoEmacs / Femto-Emacs

Tiny emacs clone with configuring in FemtoLisp
113 stars 14 forks source link

Loading files do not return value of last expression #12

Open siraben opened 6 years ago

siraben commented 6 years ago

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 commented 6 years ago

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 commented 10 months ago

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.