bug-kawa
[Top][All Lists]
Advanced

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

[Bug-kawa] [bug #37352] Syntax shortcut for curried functions


From: Christoffer Sawicki
Subject: [Bug-kawa] [bug #37352] Syntax shortcut for curried functions
Date: Fri, 14 Sep 2012 15:49:12 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1

URL:
  <http://savannah.gnu.org/bugs/?37352>

                 Summary: Syntax shortcut for curried functions
                 Project: Kawa
            Submitted by: qerub
            Submitted on: Fri 14 Sep 2012 03:49:12 PM GMT
                Category: Scheme language
                Severity: 3 - Normal
              Item Group: Feature Request
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Many Scheme implementations (including Racket, Chicken, Guile and Gauche) --
but not Kawa -- have a syntax shortcut for curried functions:


(expand '(define ((f x) y) 'z))
; => '(define f (lambda (x) (lambda (y) 'z)))


Could this be added to Kawa?

An implementation should basically not have do anything more than this:


(define-syntax-case define+curry ()
  ((_ ((xs ...) ys ...) body ...)
   #`(define+curry (xs ...) (lambda (ys ...) body ...)))
  ((_ args ...)          
   #`(define args ...)))


An implementer should also keep rest arguments in mind:


(expand '(define ((f . xs) . ys) 'z))
; => '(define f (lambda xs (lambda ys 'z)))





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37352>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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