Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #57208
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Russians about standard (survey taken in 2010 ) |
| Date | 2017-04-12 21:06 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <87ziflhrxx.fsf@nightsong.com> (permalink) |
| References | <81f347ba-7521-4afc-a294-4f7d9f795cac@googlegroups.com> <c9457648-b32e-4e41-958f-f271f0f955fe@googlegroups.com> <b24a458a-48c3-467a-86c3-8734c5777698@googlegroups.com> <87a87ljgmr.fsf@nightsong.com> <ocmivh$bs0$1@cherry.spenarnc.xs4all.nl> |
albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) writes:
> You say that because of familiarity with Lisp. I cannot recognize
> Lisp features in Python. Let's take memoizing. Python has an
> akward syntax for that. It is undoubtedly present in Lisp and
> I probably would find that easy to understand and transparent.
Python doesn't have any syntax for memoization that I know of, but you
could do it with a decorator, i.e. a higher-order function that wraps
another function when you use some special syntax to do so. E.g. this
prints the 1000th fibonacci number almost instantly, while a
non-memoized version of the recursive fibonacci function would
basically never finish:
import sys
def memoize(func):
memo = { } # empty dictionary
def mem_func(*args):
if args in memo: return memo[args]
memo[args] = func(*args)
return memo[args]
return mem_func
@memoize
def fibonacci(n):
if n in [0,1]: return 1
return fibonacci(n-1) + fibonacci(n-2)
sys.setrecursionlimit(10000)
print fibonacci(1000)
In Lisp (maybe easier, Scheme) you can do similar things without the
syntactic hair, by defining a HOF that does the memoization, using
macros, etc.
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 13:49 -0700
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-11 17:11 -0400
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 14:40 -0700
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-11 18:17 -0400
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 15:26 -0700
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-11 19:11 -0400
Re: Russians about standard (survey taken in 2010 ) "Elizabeth D. Rather" <erather@forth.com> - 2017-04-11 13:13 -1000
Re: Russians about standard (survey taken in 2010 ) The Beez <the.beez.speaks@gmail.com> - 2017-04-14 06:11 -0700
Re: Russians about standard (survey taken in 2010 ) "Elizabeth D. Rather" <erather@forth.com> - 2017-04-11 13:12 -1000
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 16:38 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 16:46 -0700
Re: Russians about standard (survey taken in 2010 ) Paul Rubin <no.email@nospam.invalid> - 2017-04-11 17:17 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 17:45 -0700
Re: Russians about standard (survey taken in 2010 ) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-04-12 04:27 -0500
Re: Russians about standard (survey taken in 2010 ) The Beez <the.beez.speaks@gmail.com> - 2017-04-14 06:13 -0700
Re: Russians about standard (survey taken in 2010 ) "Elizabeth D. Rather" <erather@forth.com> - 2017-04-14 10:23 -1000
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-11 20:17 -0400
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 17:35 -0700
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-11 20:43 -0400
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 17:47 -0700
Re: Russians about standard (survey taken in 2010 ) Julian Fondren <julian.fondren@gmail.com> - 2017-04-11 18:36 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-12 16:35 -0700
Re: Russians about standard (survey taken in 2010 ) Paul Rubin <no.email@nospam.invalid> - 2017-04-12 17:27 -0700
Re: Russians about standard (survey taken in 2010 ) albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-04-13 03:06 +0200
Re: Russians about standard (survey taken in 2010 ) Paul Rubin <no.email@nospam.invalid> - 2017-04-12 21:06 -0700
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-12 20:00 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-13 06:44 -0700
Re: Russians about standard (survey taken in 2010 ) Alex <alex@rivadpm.com> - 2017-04-13 15:44 +0100
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-13 14:04 -0700
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-14 11:08 -0700
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-14 13:23 -0700
Re: Russians about standard (survey taken in 2010 ) Alex <alex@rivadpm.com> - 2017-04-14 22:42 +0100
Re: Russians about standard (survey taken in 2010 ) Alex <alex@rivadpm.com> - 2017-04-14 22:38 +0100
Re: Russians about standard (survey taken in 2010 ) albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-04-15 13:44 +0200
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-14 10:28 -0700
Re: Russians about standard (survey taken in 2010 ) Alex <alex@rivadpm.com> - 2017-04-14 22:24 +0100
Re: Russians about standard (survey taken in 2010 ) albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-04-15 13:54 +0200
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-15 15:02 -0700
Re: Russians about standard (survey taken in 2010 ) Julian Fondren <julian.fondren@gmail.com> - 2017-04-15 15:40 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-16 10:28 -0700
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-17 22:12 -0400
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-18 23:37 -0700
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-19 15:31 -0400
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-15 20:43 -0400
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-15 18:14 -0700
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-15 21:49 -0400
Re: Russians about standard (survey taken in 2010 ) Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2017-04-16 20:20 +0100
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-16 20:41 -0700
Re: Russians about standard (survey taken in 2010 ) Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2017-04-17 09:03 +0100
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-16 20:49 -0700
Re: Russians about standard (survey taken in 2010 ) Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2017-04-17 09:25 +0100
Re: Russians about standard (survey taken in 2010 ) Alex <alex@rivadpm.com> - 2017-04-17 16:32 +0100
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-17 22:19 -0400
Re: Russians about standard (survey taken in 2010 ) Alex <alex@rivadpm.com> - 2017-04-18 13:51 +0100
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-19 02:15 -0400
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-19 10:54 -0700
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-19 11:03 -0700
Re: Russians about standard (survey taken in 2010 ) "Elizabeth D. Rather" <erather@forth.com> - 2017-04-17 12:37 -1000
Re: Russians about standard (survey taken in 2010 ) hughaguilar96@gmail.com - 2017-04-15 17:18 -0700
Re: Russians about standard (survey taken in 2010 ) Alex <alex@rivadpm.com> - 2017-04-16 09:07 +0100
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-11 23:26 -0400
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-12 16:47 -0700
Re: Russians about standard (survey taken in 2010 ) rickman <gnuarm@gmail.com> - 2017-04-12 19:53 -0400
Re: Russians about standard (survey taken in 2010 ) Julian Fondren <julian.fondren@gmail.com> - 2017-04-11 19:03 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-12 16:45 -0700
Re: Russians about standard (survey taken in 2010 ) JUERGEN <epldfpga@aol.com> - 2017-04-12 01:15 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-12 16:51 -0700
Re: Russians about standard (survey taken in 2010 ) lehs <skydda.barnen@gmail.com> - 2017-04-11 18:47 -0700
Re: Russians about standard (survey taken in 2010 ) Mark Wills <markwills1970@gmail.com> - 2017-04-12 01:19 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-12 16:57 -0700
Re: Russians about standard (survey taken in 2010 ) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-12 09:14 +0000
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-12 17:00 -0700
Re: Russians about standard (survey taken in 2010 ) "HAA" <someone@microsoft.com> - 2017-04-13 10:15 +1000
Re: Russians about standard (survey taken in 2010 ) "HAA" <someone@microsoft.com> - 2017-04-13 13:17 +1000
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-13 06:46 -0700
Re: Russians about standard (survey taken in 2010 ) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-13 05:59 -0700
Re: Russians about standard (survey taken in 2010 ) "HAA" <someone@microsoft.com> - 2017-04-14 11:26 +1000
csiph-web