diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-05-20 22:12:57 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-05-20 22:12:57 -0700 |
| commit | 54d5bfe751d8489ae727eec1cb8d4a9a2279a5e5 (patch) | |
| tree | c727dccb9f50f5a74c4d541a3fdf38a89cf379f3 /core-plus.e | |
| parent | 272c9cf16bbca81ff0e15840c4dc8fd0bbce3ad8 (diff) | |
tidied away core-plus.e
it's merged into core now. that just made the most sense... a couple of its combinators are too useful to not use once you know about them Force-Push: yes Change-Id: I3857f353a8603960bebbf34f24572e3d5815f0de
Diffstat (limited to 'core-plus.e')
| -rw-r--r-- | core-plus.e | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/core-plus.e b/core-plus.e deleted file mode 100644 index d323816..0000000 --- a/core-plus.e +++ /dev/null @@ -1,33 +0,0 @@ -~ This is a temporary holding place for stuff that probably should be in -~ core someday, but only after carefully considering whether to rewrite it in -~ assembly. Most of it originally came from boot_source in quine.asm. - - -~ Now some fancier stack combinators. -~ -~ While it might be nice, for performance reasons, to do these in -~ assembler, for now it's more important to have them at all. -: 1- 1 - ; -: 1+ 1 + ; -: max 2dup >= { swap drop } { drop } if-else ; -: min 2dup <= { swap drop } { drop } if-else ; - -: over swap dup 3unroll ; -: pick 2 + dup roll dup 3roll unroll ; - -~ Standard Forth doesn't have equivalents of our ndrop and ndup. The HP -~ calls them DROPN and DUPN but that doesn't go well with ie. 2dup or 3roll, -~ so we do it like this. -: ndrop { dup } { swap drop 1- } while drop ; -: ndup dup 1+ swap { dup } - { swap dup pick 3unroll swap 1- } while 2drop ; -: 3drop drop drop drop ; -: 3dup 2 pick 2 pick 2 pick ; - -: && 0 != swap 0 != * ; -: || | 0 != ; -: not 0 = ; -: negate -1 * ; - -: align-floor dup 3unroll /% swap drop * ; - |