- Added
$
operator, which destructures a s-exp at the top of the stack into the forth equivalentex.
;; Traditional Forth Expression to add two numbers 2 2 + . ;; 4 ;; $-Expression alternative (+ 2 2) $ . ;; 4
This should add a certain level of familiarity, with a nested word operator being something that might be added in the future for collections of s-expressions.
More advanced examples
(reduce *+ (range 1 10)$)$ . ;; 45
The new word function is actually pretty easy to implement yourself while in fif:
fn $ [coll] & coll rest apply coll first apply endfn (+ 2 2) $ . ;; 4
- Added documentation strings and appropriate groups to any unassigned or undocumented stdlib word functions to display better in fifiql.
- Fixed error handling checks to be more resilient to non-collections
- Added
list-words
word function to return a list all words and their metadata that exist within the given stack machine.
- Improved the realizer
?
- Non-collection values pass through without error
- Bug Fix: Symbols containing a collection are now correctly evaluated
- Added new operator, the multi-realizer
??
, which is a catch-all realizer for collections containing nested collections. This removes the need to chain the realizer to realize inner collections.ex.
fn name *first-name <> setl *last-name <> setl {:first-name first-name :last-name last-name} ? endfn ;; ;; before ;; [{:user-data ("Ben" "Zap" name) :email "[email protected]"} ? {:user-data ("John" "Doe" name) :email "[email protected]"} ?] ? ;; ;; after ;; [{:user-data ("Ben" "Zap" name) :email "[email protected]"} {:user-data ("John" "Doe" name) :email "[email protected]"}] ??
- Added a new destructuring operator ‘&’, which creates local
variables from a supplied vector of parameters, and arguments
which reside on the stack
ex.
1 2 3 [a b c] & a b c ;; '(1 2 3)
This can be used in tandem with a function to assign stack values to parameters in a much clearer way.
ex.
;; ;; before ;; fn name *first-name <> setl *last-name <> setl {:first-name first-name :last-name last-name} ? endfn ;; ;; after ;; fn name [first-name last-name] & {:first-name first-name :last-name last-name} ? endfn
- Added a new destructuring operator ‘&’, which creates local
variables from a supplied vector of parameters, and arguments
which reside on the stack
- Added coercion word functions
int
,float
,boolean
- Clojure only:
char
,rationalize
,numerator
,denominator
- Clojure only:
- Added math word functions
PI
,E
,acos
,asin
,atan
,atan2
,cbrt
,ceil
,cos
,cosh
,exp
,floor
,log
,pow
,round
,sin
,sinh
,sqrt
,tan
,tanh
- The realizer has been updated to work with maps.
Examples
def a 10 def b 12 {:a a :b b} ? . ;; {:a 10 :b 12}
As you can see, symbols are realized. Note that lists are realized as well, while other collection types are ignored
More Advanced Examples
{:a (2 2 +)} ? . ;; {:a 4} {:a (2 2 2 +)} ? . ;; {:a (2 4)} {:a [2 2 +]} ? . ;; {:a [2 2 +]} {:a ([2 2 +] ?)} ? . ;; {:a [4]}
- Added piecewise word functions,
%
,%1
,%2
, and%3
- These word functions allow you to dereference word variables
that have been placed on the stack ex.
def x 2 *x 2 + . ;; Error, x has to be dereferenced
The fix
def x 2 *x % 2 + . ;; *x is placed back on the code queue and dereferenced ;; alternatives *x %1 2 + . *x 2 %2 + .
It can also be used to reorganize values on the stack
a b c %3 .s ;; <3> (b c a) a b c %2 %3 .s ;; <3> (c b a)
- How is this different from
over
and other such stack modication functions?The difference is that it is placed back on the code queue for re-evaluation, so it can make for some interesting dereferencing techniques that weren’t possible before.
example:
doc assocv "( w k v -- 'w ) Associate key-value pair into word variable" fn assocv *v <> setl *k <> setl dup % k v assoc setg endfn def x {:a 1 :b 2} *x :c 3 assocv x . ;; {:a 1 :b 2 :c 3}
- These word functions allow you to dereference word variables
that have been placed on the stack ex.
- Added
symbol
word function - Added
pprint
word function
- Fixed clojar deployment
- Hot-Fixed clj build of fif
- Hot-Fixed cljs build of fif
- Improved commandline with evaluation and repl support
- Minor documentation grammar fixes for display word operations
- fif can now be compiled into a native executable using GraalVM’s
native-image
. Please refer to the readme. - Introduced new word definitions for the commandline version of fif
slurp
,spit
,spita
,read-file
, andload-file
.
- First Production Release, and the start of changelog recordings.