Thanks James.
If any one else is as new to functional stuff as me then I found this
in Paul Graham's book which enables me to reason logically about the
matter (hopefully)
"A good compiler can compile a tail call into a goto, and so can
compile a tail recursive function into a loop. In typical ma
On Tue, Jun 15, 2010 at 3:28 PM, James Reeves wrote:
> Well, the docs do say "recur in other than a tail position is an
> error", though that does assume the reader knows what the tail
> position of a function is.
see, for example, @tailrec in scala.
--
You received this message because you are
On 15 June 2010 22:56, Quzanti wrote:
> Thanks Mike.
>
> So does is the only kind of recursion optimisation tail recursion?
>
> Can you only eliminate stack calls in tail calls?
No, you can also eliminate stack calls using lazy-seq or trampolines.
If you provide some example code of what you are
Thanks Mike.
So does is the only kind of recursion optimisation tail recursion?
Can you only eliminate stack calls in tail calls?
Having some sort of hint about this in the recur documentation might
be helpful?
On Jun 15, 2:32 pm, Mike Meyer wrote:
> On Tue, 15 Jun 2010 03:24:08 -0700 (PDT)
>
On Sun, Jun 13, 2010 at 8:39 AM, Oleg wrote:
> Thank you, but could you provide me a little code snippet which will
> iterate through collection and assoc "children" key for each row.
>
> On 13 июн, 16:35, Andrzej wrote:
>> On Sun, Jun 13, 2010 at 7:35 PM, Oleg wrote:
>>
>> > Currently i'm just
On Tue, 15 Jun 2010 03:24:08 -0700 (PDT)
Quzanti wrote:
> You can use recur to build a hierarchy. What do you mean by you can't
> use it as it is not the last statement?
Exactly that. recur in some sense terminates the current call, and
hence is required to be the last statement in the call.
>
You can use recur to build a hierarchy. What do you mean by you can't
use it as it is not the last statement?
I have used recur in all sorts of places in the fn, without noticing
any restrictions, and built hierarchies.
I am no expert so I may have been conforming to the restrictions
accidentally
On 13 June 2010 11:35, Oleg wrote:
> Currently i'm just calling function, but there is a danger of
> StackOverflow. I can't use recur, because it's not last statement. As
> i can understand recur is good to build long sequences, but in my case
> i'm building hierarchy.
If you're only recursing to
I've looked at tree-seq and can say that is not suitable for non-tail
"children" tasks.
For example how can i attach subtotal row to bottom of each level. Any
ideas?
On 13 июн, 16:35, Andrzej wrote:
> On Sun, Jun 13, 2010 at 7:35 PM, Oleg wrote:
>
> > Currently i'm just calling function, but th
Thank you, but could you provide me a little code snippet which will
iterate through collection and assoc "children" key for each row.
On 13 июн, 16:35, Andrzej wrote:
> On Sun, Jun 13, 2010 at 7:35 PM, Oleg wrote:
>
> > Currently i'm just calling function, but there is a danger of
> > StackOver
On Sun, Jun 13, 2010 at 7:35 PM, Oleg wrote:
>
> Currently i'm just calling function, but there is a danger of
> StackOverflow. I can't use recur, because it's not last statement. As
> i can understand recur is good to build long sequences, but in my case
> i'm building hierarchy.
Two potential s
Hello Guys!
Here is the task:
Assume that we have function called `fetch-from-source`, which used to
fetch vector of maps from the data source. I want to make iteration on
every fetched row (element of vector) and ask `fetch-from-source`
again to add 'children' key to that row. And so on, until g
12 matches
Mail list logo