bugKawa - Bugs: bug #37352, Syntax shortcut for curried...

 
 

bug #37352: Syntax shortcut for curried functions

Submitter:  Christoffer Sawicki <qerub>
Submitted:  Fri 14 Sep 2012 03:49:12 PM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Feature Request Status:  Postponed
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 16 Sep 2012 11:48:06 AM UTC, comment #2: 

Fair enough! Thank you for considering.

Christoffer Sawicki <qerub>
Fri 14 Sep 2012 10:56:04 PM UTC, comment #1: 

I'm not sure this is a good idea.  I'm somewhat concerned about complicating the lambda syntax further, given that Kawa already supports #!optional and #keyword parameters.  Furthermore, I've started exploring a more general pattern mechanism which would also be used in parameter lists, further complicating them.  So I think it's best to first figure out how patterns are going to work, before considering this currying extension.

Per Bothner <bothner>
Group administrator
Fri 14 Sep 2012 03:49:12 PM UTC, original submission:  

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)))


Christoffer Sawicki <qerub>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by qerub (Submitted the item)
  • -email is unavailable- added by qerub
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-09-14 bothner StatusNone Postponed
    2012-09-14 qerub Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code