Comments (3)
Even if named vars can be considered (a bite out of pure point-free).
# discriminant (with locally named args)
2 3 4 quo [c] def quo [b] def quo [a] def
b dup * 4 a * c * -
# >>> -23
## but the problem is that we really don't want args defined globally, so...
[a b c] [b dup * 4 a * c * -] [discriminant] define
2 3 4 discriminant
# >>> -23
The alternate pure point-free is a tangle of stack shufflers.
from pounce_v0.
[a b c op] [b -1 * b b * 4 a * c * squareroot op 2 a * /] [quadratic-crossing]
[a b c] [a b c discriminant dup 0 < [[]] if dup 0 > [[ a b c [+] quadratic-crossing] ...] [] if-else] [quadratic]
manageable with the local-defined values (words) , but the stack swapping version is too complex to show here.
from pounce_v0.
since define
has matured into a useful construct with local-words, adding named-args
(e.g. named-args:[x y]) to consume stack arguments into getters to be used in the definition and local-words seem like an interesting enough idea to pursue.
{named-args: [a b c]
local-words: { discriminant: [ ... ] quadratic-crossing: [ ... ] ... }
definition: [a b c discriminant dup 0 < [[]] if dup 0 > [[ a b c [+] quadratic-crossing] ...]
} [quad] define
from pounce_v0.
Related Issues (20)
- UI for words! Visual Recursive Expansion, CRUD HOT 2
- Ultra basic Canvas output (only) as a simple demo HOT 1
- canvas DOM element id from the stack (not be hard-coded)
- words defined in local scope aka 'local-def' (helper words)
- ifte word (quoted conditional expression)
- Wrap Pounce in JS closure
- isNumber is not defined in external pounce dictionary
- large calculations can lock up browser
- 'C' interpreter
- Quoted string '+' is interpreted as +
- save state in local/session storage
- cultivate core words
- Parser breaks words in two that start with numbers
- parser does not handle comment of nothing but a newline
- import of dictionaries needs refactor of the runtime HOT 1
- enforce 'expects' stack validation
- trouble with fn words ending bare on the stack
- add a word `scoop` that removes stack items an registers them as local scoped/defined words that HOT 1
- Word types and type checking
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 pounce_v0.