top | item 39298560

(no title)

zoltar | 2 years ago

There was always something I liked about Forth when I didn't have to do much stack-thinking. One of the things that felt forth-y to me when I first encountered it was threaded code in Clojure (or any other point-free kind of idiom for that matter).

https://santhoshkris.medium.com/threading-macros-in-clojure-...

I'll sometimes abuse Python's compose to do similar things I won't send out for code review. Maybe I really should just try to live in Coconut instead of silly stuff like:

  import chess
  import chess.svg
  from IPython.display import SVG, display
  from functools import reduce
  
  
  def rcompose(*fs):
      return reduce(lambda f, g: lambda *xs, **ys: g(f(*xs, **ys)), fs)
  
  inline_board = rcompose(
          chess.Board,
          chess.svg.board,
          SVG,
          display)

Factor's quotations dealing with stack management weirdness is super nice, too.

https://concatenative.org/wiki/view/Concatenative%20language...

It still has a bit more stack juggling than I like, though. That could just be a "me" problem. Props to that whole community for their effort.

https://www.youtube.com/watch?v=f_0QlhYlS8g

discuss

order

No comments yet.