Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

When to Use Macros

Name: Anonymous 2013-07-10 8:53

http://www.bookshelf.jp/texi/onlisp/onlisp_9.html#SEC61
(defmacro while (test &body body)
  `(do ()
       ((not ,test))
     ,@body))


There is no way to duplicate the behavior of this macro with a function.

It is true for shitty CL. But it is false for a Lisp that supports fexprs.

Name: Anonymous 2013-07-10 22:19

Haskell doesn't need shitty hacks like macros. Plus you can write it point-free for improved readability:

import Control.Monad
import Control.Monad.Instances
import Data.Function

while :: Monad m => m Bool -> m a -> m ()
while = fix$join.(.(>>=)).(.(.)).(.(.)).(.(join.)).(.(.((flip when.).))).(.(.(.(>>)))).(.(.flip(.))).flip(.)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List