Comments (9)
I think that the library with the function added was never actually loaded into the REPL - I guess it had only been done so transitively via the require call to it.
There's no difference between these two situations; if a module is loaded transitively or directly it behaves the same either way.
from fennel.
Try M-x fennel-reload
or C-c C-k
.
from fennel.
I had tried that, but it doesn't seem to work either. In executing sum-1
manually in the REPL or via C-c C-e
directly in the buffer (which I'm more oft to do), it is convinced that t.add
doesn't exist.
from fennel.
Did you reload the module that you added the function to, or the module that's calling the one that changed?
If it's the first one, it could be a bug. Can you provide a repro case? Also try reloading with ,reload transducers
in the repl; it should be the same thing as M-x fennel-reload
.
from fennel.
I think that the library with the function added was never actually loaded into the REPL - I guess it had only been done so transitively via the require
call to it. Let me reproduce this and get back to you.
from fennel.
Okay, there seem to be multiple things happening here.
Setup
- Have a symlink to https://github.com/fosskers/transducers.fnl/blob/master/transducers.fnl in the local testing directory.
- Add the following to a testing file:
(local t (require :transducers))
(fn sum-1 [tensor]
"Sum the elements of a Rank-1 tensor."
(t.transduce t.pass t.add tensor))
(sum-1 [1 2 3])
{:sum-1 sum-1}
- Comment out the
add
export within the transducers file.
This is the starting setup for both scenarios below. I completely restart Emacs between each scenario to ensure a clean slate.
Scenario 1: The REPL
- Open testing file.
- C-c C-k
- Completion does not work for
t
symbol. - Bind this module to a local in the REPL.
- Call sum-1 in REPL; fails, since t.add doesn't exist yet.
- Open transducers buffer and export
add
. - C-c C-k once again in testing file.
- Can call sum-1 in REPL without needing to rebind the local (convenient!)
- But, error in REPL implying t.add is nil.
Scenario 2: The Buffer
This is more often how I work with Lisps; local one-liners that I execute for testing without typing things in the REPL manually.
- Open testing file.
- Attempt C-c C-e on local one-liner for testing.
- It fails: sum-1 is not loaded.
- C-c C-e on sum-1: it fails, transducers hasn't been loaded.
- C-c C-e on
require
line, then sum-1 again. - C-c C-e on the one-liner: fails,
add
isn't exported yet. - Open transducers buffer and export
add
. - C-c C-e on the
require
doesn't overwrite what the Lisp process already holds;add
continues not to exist.
Lines of Inquiry
- Could the symlink have anything to do with it?
- How come the REPL (the Lisp process?) seems to get in different states between
C-c C-k
and individualC-c C-e
calls? (re: completions)
from fennel.
Also try reloading with
,reload transducers
in the repl;
This works, by the way (for Scenario 2).
from fennel.
In scenario 1, you said you're only reloading the testing file. You need to reload the file that changed in order to have the changes reflected in the repl.
In scenario 2 it sounds like you're trying to run code that refers to things that haven't been loaded yet. Re-running require
has no effect; you have to reload in order to get the new changes in a module to show.
from fennel.
Thanks. After playing around more last night, I think the proper mental model (and the one you're hinting at) is to use a single REPL session across multiple Fennel projects (if they're interdependent), and make sure everything is C-c C-k
'd properly.
I'll close this for now, cheers.
from fennel.
Related Issues (20)
- Incomplete `for` binding table results in bad code generated HOT 1
- Macro treat vararg as first parameter... Unless quoted and unqoted. HOT 5
- Compatibility with Pluto HOT 6
- Cannot use &as with a rest parameter. HOT 2
- Expose the 'varg' function to the compiler environment HOT 4
- `,apropos-doc` cannot find functions defined in REPL HOT 1
- `,apropos-show-docs` not working HOT 1
- Bad code generated in the REPL if the name of a local contains a backslash
- Luau syntax support HOT 4
- [Enhancement] Allow passing special forms as functions in macro context HOT 3
- [Feature Request] Global macro definitions HOT 1
- [Stdlib] Add type check macros HOT 1
- readline support HOT 10
- macro question: access a function's form inside a macro HOT 1
- Creating macro which unpacks arbitrary number of arguments yields incorrect result HOT 2
- Cannot rename argument when using docstring and metadata at the same time in lambda HOT 1
- Line numbers in errors and stack incorrect in `dofile` HOT 2
- Hello! Is about the style.md file on the main repository HOT 4
- REPL doesn't store `gensym`'ed variables? HOT 3
- M HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fennel.