guile-user
[Top][All Lists]
Advanced

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

Re: currying


From: Thien-Thi Nguyen
Subject: Re: currying
Date: Tue, 07 Sep 2010 17:07:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

() "Eric J. Van der Velden" <address@hidden>
() Mon, 6 Sep 2010 21:36:58 +0200

   (define neither
     (both (compose not))

   The first one doesn't compile. The second one does, but this is
   not what I meant; It suspects two arguments, the '() '() for
   example, instead of one, the funtion null? for example.

   Can I define (neither) is some way that I can do something like

   ((neither null?)'(a)'(a))

Presuming that you'd like this expression to have value #t, try:

(define neither
  (lambda (p?)
    (both ((compose not) p?))))

aka

(define (neither p?)
  (both ((compose not) p?)))

Style nit: i somewhat dislike the one-arg ‘compose’.  IMHO, the
procedure most befitting that name should take any number of args,
including zero.  That complicates the implementation, but such is
life on the edge of the knife...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]