Congradulations! You've discovered Fexprs! An ancient technology from a
by-gone age: https://en.wikipedia.org/wiki/Fexpr

On Tue, Apr 26, 2016 at 2:23 PM, Olek <aleksander.nas...@gmail.com> wrote:

> Yes, the delay and force does the job. Now it would be nice to hide delay
> declaration in arguments destruction as already proposed:
>
>  (den mycrazyif [ statement ~onsuccess ~onfailure ] ; nonsuccess and on
> failure becomes delay objects
>    (if statement   ; just evalutated with mycrazyif call
>      @onsucess ; deref block in case of success
>           @onfailure)) ; deref block in case of failure
>
>
> On Tuesday, 26 April 2016 19:59:12 UTC+2, Michael Griffiths wrote:
>>
>> I'm not sure I fully understand your proposal, but when I really need
>> lazy evaluation (which is pretty rare) I reach for `delay` and `force`.
>>
>> On Tuesday, 26 April 2016 16:41:08 UTC+1, Olek wrote:
>>>
>>> Hi!
>>>
>>> In short:
>>>
>>> I have noticed that in most cases I use macros only for lazy arguments
>>> evaluation. Why not to make something to use only this feature? It would be
>>> light version of macro for clojurescript/clojure and easy to grasp for
>>> newcomers and still powerful in programming (with that you could implement
>>> binding/scopes/interpreter pattern). I love implicite use of macros where
>>> from call point of view the user can't distinguish what is function and
>>> what is macro.
>>>
>>> In long:
>>>
>>> Generally the macros are used in compile phase to manipulate AST (or
>>> just data structures because Clojure is homoiconic) to produce code in
>>> order to be consumed in evaluation phase.
>>> It is nice to include new language constructs with use of macros but as
>>> my experience points out for most time I use macros only for changing
>>> evaluation moment/order.
>>> Maybe there should be some construct like "defnlazy" for which you write
>>> normal function but all input arguments are evaluated only when you
>>> explicitly evaluate them.
>>> What we gain? We don't have to deal with # ` @ list eval and separate
>>> thoughts on read/eval phases, but we still must explicitly say ~ to deref
>>> passed block of construct as argument.
>>>
>>> Also there are some problems to grasp:
>>> - is it safe to implicite convert blocks of construct from statements to
>>> deref objects
>>> - how it should behave when you pass not deref object to another
>>> discussed "defnlazy"
>>> - maybe there shouldn't be any defnlazy but you should just implement it
>>> in arguments destruction so you can use constructs like:
>>>
>>> (defn mycrazyif [ statement ~onsuccess ~onfailure ]
>>>    (if statement   ; just evalutated with mycrazyif call
>>>      @onsucess ; deref block in case of success
>>>           @onfailure)) ; deref block in case of failure
>>>
>>>
>>> With regards,
>>> Olek
>>>
>> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to