Would an idiomatic definition of ((A)) be (defn fnA [] #(A))?

(defn a [] [:a :b])
(a)
; (a => fn) => [:a :b]
(defn funcA [] #(a))
(funcA)
; (funcA => fn)
((funcA))
; ((funcA)) => [:a :b]

Where you define a function which, when invoked, returns a function which,
when invoked, invokes A? This is a standard pattern that I've used for
continuation-passing style, and for the construction of monadic values.

The syntax isn't as clean as your example above, but I personally think it
makes more sense.

Unless I'm missing what you're trying to achieve.

- DAemon

On Fri, Aug 31, 2012 at 8:57 AM, Armando Blancas <abm221...@gmail.com>wrote:

> Let's take it case by case.
>
> (define A 1) is like (def A 1) in Clojure.
> (define (A) 1) is like (defn A [] 1)
> (define (A x y) (* x y)) as you'll expect, (defn A [x y] (* x y))
>
> (define (A) 1)   is the same as   (define A (lambda () 1)) ;; defines
> procedure "A"
> (define ((A)) 1) is the same as   (define (A) (lambda () 1));; defines
> procedure "(A)"
>
>
> On Thursday, August 30, 2012 2:48:39 PM UTC-7, Andy C wrote:
>>
>> I use Rocket Scheme. The question was inspired by "Structure and
>> Interpretation"  
>> http://www.youtube.com/watch?**v=2Op3QLzMgSY<http://www.youtube.com/watch?v=2Op3QLzMgSY>
>>  at almost
>> end of the video  @ 1:11:11
>>
>> I actually think that "((A))" is more just a symbol name since
>> apparently you define "A" not a "((A))"/ It is more like a
>> recursive/nested symbol name. Very neat and simple concept I am
>> seeking a formal explanation for.
>>
>> A.
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to