[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cut and the operators mu and nu

This page is part of the web mail archives of SRFI 86 from before July 7th, 2015. The new archives for SRFI 86 are here. Eventually, the entire history will be moved there, including any new messages.

The specifications of mu and nu are:

  (mu <expr> ...)          => (lambda (f) (f <expr> ...))
  (nu <expr> ... <exprn>)  => (lambda (f) (apply f <expr> ... <exprn>))
  The <exprn> should be a list.

These are indeed useful operations. So useful that we already have
a srfi for them, namely srfi-26.

(cut <> <expr> ...)
                           => (lambda (f) (f <expr> ...))
(cut apply <> <expr> ... <exprn>)
                           => (lambda (f) (apply <expr> ... <exprn>))


  Welcome to DrScheme, version 301.12-svn5apr2006.
  Language: Pretty Big (includes MrEd and Advanced Student).
  > (require (lib "26.ss" "srfi"))
  > (define m (cut <> 1 2))
  > (m list)
  (1 2)
  > (define n (cut apply <> 1 '(2 3)))
  > (n list)
  (1 2 3)

Jens Axel Søgaard