Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Jon Kleiser
Thanks for all the answers. The reason I asked was, I’ve been playing a bit with Racket doing some “heavy” floating-point math, and I got quite used to the ‘foldl’ function. Then I couldn’t remember having seen that function or anything quite similar i PicoLisp. /Jon > On 9. Oct, 2018, at

Re: GNU Emacs picolisp-mode

2018-10-09 Thread Tedd M. V.
Henrik Sarvell writes: > I attached my slightly modified version. Cool, thank you! ;-) -- -BEGIN GEEK CODE BLOCK- Version: 3.12 GAT d- s+:+ a? C UL P+ L+++ E+ W+++ N+ o-- K+ w O-- M- V- PS++ PE Y+ PGP++ t+ 5 X+ R tv- b+++ DI-- D+ G++ e* h! r- z* --END GEEK CODE

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Mike
hi all, My demo code to mimic racket's reference: https://bitbucket.org/mihailp/tankfeeder/src/default/foldl.l (mike) -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread John Duncan
Isn't it destructive to I? On Tue, Oct 9, 2018, 10:30 AM Mike wrote: > hi all, > > My demo code to mimic racket's reference: > https://bitbucket.org/mihailp/tankfeeder/src/default/foldl.l > > (mike) > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe >

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Alexander Burger
> On Tue, Oct 9, 2018, 10:30 AM Mike wrote: > > > hi all, > > > > My demo code to mimic racket's reference: > > https://bitbucket.org/mihailp/tankfeeder/src/default/foldl.l Perfect! On Tue, Oct 09, 2018 at 10:57:43AM -0400, John Duncan wrote: > Isn't it destructive to I? You mean the line

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread John Duncan
Yes, you couldn't reuse the same initial value for a data structure like you would in scheme On Tue, Oct 9, 2018, 12:15 PM Alexander Burger wrote: > > On Tue, Oct 9, 2018, 10:30 AM Mike wrote: > > > > > hi all, > > > > > > My demo code to mimic racket's reference: > > >

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Alexander Burger
On Tue, Oct 09, 2018 at 01:21:07PM -0400, John Duncan wrote: > Yes, you couldn't reuse the same initial value for a data structure like > you would in scheme How do you mean that? As I said, this code is completely free of destructive side effects. You can use and reuse any initial value. But

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread rick
On Tue, 09 Oct 2018 14:24 +, Mike wrote: > My demo code to mimic racket's reference: > https://bitbucket.org/mihailp/tankfeeder/src/default/foldl.l Excellent! I'm stealing this! :) Thanks! -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread rick
On Tue, 09 Oct 2018 19:31 +0200, Alexander Burger wrote: > On Tue, Oct 09, 2018 at 01:21:07PM -0400, John Duncan wrote: > > Yes, you couldn't reuse the same initial value for a data structure like > > you would in scheme > > How do you mean that? As I said, this code is completely free of

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread John Duncan
Yes, it makes more sense in reducing type languages like scheme and Haskell, where its operating model is identical to the recursion that would normally be implemented. On Tue, Oct 9, 2018, 4:03 PM Johann-Tobias Schäg wrote: > > > It is quite inefficient, as it needs to build a new list of >

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Alexander Burger
On Tue, Oct 09, 2018 at 09:57:48PM +0200, Johann-Tobias Schäg wrote: > > It is quite inefficient, as it needs to build a new list of > all arguments > > on > > each call: > Well i see ways how it could be speed up it up in assembly but only by adding > lots of complexity. Yes. I'm afraid it

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Johann-Tobias Schäg
> It is quite inefficient, as it needs to build a new list of > all arguments on > each call: Well i see ways how it could be speed up it up in assembly but only by adding lots of complexity.    (conc (rest) (cons I)) > and it has no advantage over a direct inline > expression of what it does

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Jakob Eriksson
Add foldl to standard library? > 9 okt. 2018 kl. 20:59 skrev r...@tamos.net: > >> On Tue, 09 Oct 2018 19:31 +0200, Alexander Burger wrote: >>> On Tue, Oct 09, 2018 at 01:21:07PM -0400, John Duncan wrote: >>> Yes, you couldn't reuse the same initial value for a data structure like >>> you would

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread John Duncan
You're right, I was wrong :) John On Tue, Oct 9, 2018 at 3:07 PM wrote: > On Tue, 09 Oct 2018 19:31 +0200, Alexander Burger wrote: > > On Tue, Oct 09, 2018 at 01:21:07PM -0400, John Duncan wrote: > > > Yes, you couldn't reuse the same initial value for a data structure > like > > > you would

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Alexander Burger
On Tue, Oct 09, 2018 at 09:19:29PM +0200, Jakob Eriksson wrote: > Add foldl to standard library? I would not recommend that. It is quite inefficient, as it needs to build a new list of all arguments on each call: (conc (rest) (cons I)) and it has no advantage over a direct inline expression

Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Johann-Tobias Schäg
> > > It is quite inefficient, as it needs to build a new list of > all > > > arguments on > > > each call: > > Well i see ways how it could be speed up it up in assembly but only by > > adding > > lots of complexity. > Yes. I'm afraid it needs very much complexity! > Interestingly, 'foldr'