BTW: In Lisps, if is still a special form / macro, because in Lisp lists are evaluated by default, in Rebols if can be a function because blocks (lists) aren't evaluated by default.
Now about the point about Lisps and if: the regular if operator with value and expression arguments has a companion if function:
4> (special-operator-p 'if)
t
5> (fboundp 'if)
t
Unlike in some other dialects like Common Lisp, a symbol can have a binding in the macro or operator space, and in the function space at the same time.
But this if is not useful control. It's useful for things like being able to map over a function-like facsimile of the if operator. E.g. take an element of the (a b c d) or (x y z w) list depending on whether the leftmost list has a nil or t:
6> [mapcar if '(nil t nil t) '(a b c d) '(x y z w)]
(x b z d)
In the reverse direction, being able to write a macro for a function function exists, allows for ordinary macros to be "compiler macros" in the Common Lisp sense: provide optimizations for certain invocations of a function.
This dialect is not even "weird"; overall it is Common-Lisp-like. Right down to the multiple namespaces, which is why the [...] syntax exists for referring to functions and variables in a combined virtual namespace.
I checked the Rye homepage, and it has "dialects" which allow more familiar math infix notation. In that sense it is very tcl-y, tcl technically being a lisp.
Looking at their rather confusing looping mechanisms, they probably could benefit from being a little more tcl-y, since tcl has some of the best looping semantics I've worked with.
middayc|4 months ago
kazinator|4 months ago
TXR Lisp: (relevant to this article) there is an iff function that takes functional arguments.
Square the odd values in 0 to 9:
The use function is a synonym of identity: i.e. just use the incoming value as-isSquare the even ones instead by inverting oddp with notf:
Get rid of use with iffi: a two-argument iff with an implicit identity else: Now about the point about Lisps and if: the regular if operator with value and expression arguments has a companion if function: Unlike in some other dialects like Common Lisp, a symbol can have a binding in the macro or operator space, and in the function space at the same time.But this if is not useful control. It's useful for things like being able to map over a function-like facsimile of the if operator. E.g. take an element of the (a b c d) or (x y z w) list depending on whether the leftmost list has a nil or t:
In the reverse direction, being able to write a macro for a function function exists, allows for ordinary macros to be "compiler macros" in the Common Lisp sense: provide optimizations for certain invocations of a function.This dialect is not even "weird"; overall it is Common-Lisp-like. Right down to the multiple namespaces, which is why the [...] syntax exists for referring to functions and variables in a combined virtual namespace.
bloaf|4 months ago
Looking at their rather confusing looping mechanisms, they probably could benefit from being a little more tcl-y, since tcl has some of the best looping semantics I've worked with.
middayc|4 months ago
taeric|4 months ago