The Artima Developer Community
Sponsored Link

Java Buzz Forum
Partial Application and Currying Questions

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Brian McCallister

Posts: 1282
Nickname: frums
Registered: Sep, 2003

Brian McCallister is JustaProgrammer who thinks too much.
Partial Application and Currying Questions Posted: Mar 4, 2004 8:44 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Brian McCallister.
Original Post: Partial Application and Currying Questions
Feed Title: Waste of Time
Feed URL: http://kasparov.skife.org/blog/index.rss
Feed Description: A simple waste of time and weblog experiment
Latest Java Buzz Posts
Latest Java Buzz Posts by Brian McCallister
Latest Posts From Waste of Time

Advertisement

I am slowly becoming a functional programming weenie -- really cool stuff. A discussion came up on groovy-dev about how I implemented currying on closures in groovy -- it was pointed out that what I really did was partial-application.

A quick google search sort of reinforced this, but I am not sure the difference, so here is a shameless plea for explanation. Here is my current understanding (in gauche scheme):

(use rfc.http)
(use srfi-11)

(define http-get-body 
    (lambda (host file)
        (let-values (
            ((response head body) (http-get host file)))
            body)))

(define with-http-body 
    (lambda (host file func)
        (func (http-get-body host file))))

(define with-ojb 
    (lambda (func)
        (with-http-body "db.apache.org" "/ojb/index.html" func)))

(with-ojb 
    (lambda (body)
        (display body)))

I think with-ojb is partial application as it provides two of the three arguments required by with-http-body and returns a function which takes the last. If that is the case, what is currying? Until today I thought that was currying. The wikipedia seems to say this is currying, but it seems to fit exactly the haskell definition of partial application -- and the examples on the wikipedia look very different.

Help?

Read: Partial Application and Currying Questions

Topic: He's right you know. Previous Topic   Next Topic Topic: OutOfMemoryError DETAILED

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use