1.  

      SMH, of course. Forgot they started blogging about this recently.

        1.  

          Oh that’s nice.

    1.  

      Not this week, but if you want to see something interesting, guess what this snippet of code outputs:

      [f(0) for f in [lambda x: x+n for n in range(3)]]
      

      I’m sure there’s something interesting to be learned here.

      1.  

        I’m sure there’s something interesting to be learned here.

        This is happening because lambda x: x+n is closing over n, and when the inner list comprehension is complete (which it must be for the outer comprehension to be evaluated), the value of n is 2.

        If you replace the inner list comprehension with a generator comprehension, the values of the fs track as you’d expect:

        [f(0) for f in (lambda x: x+n for n in range(3))]
        
        1.  

          Even better:

          [f(0) for f in [lambda x: x+n for n in range(3) if n % 2 == 0]]
          
          1.  

            Huh…I thought integers were value types, not reference types, in python?

            1.  

              There are no ‘value types’ or ‘reference types’ in Python and it is misleading to think of them this way. Variables in Python are names that refer to objects. That list comprehension introduces a single new name n that is reassigned to upon every iteration of the loop, whereas it seems like most peoples’ intuition would be that every iteration of the loop introduces a new variable. There’s no value type/reference type stuff going on here: the lambda functions capture the variable n lexically.

              1.  

                There are no ‘value types’ or ‘reference types’ in Python and it is misleading to think of them this way. Variables in Python are names that refer to objects.

                It’s semantics, really. If you have a name which refers to an object, and the underlying representation of that object is a pointer which refers to another object, then that object can reasonably be referred to as a reference type, since in-place changes to the object will be reflected in other copies of it.

                In any case, I am very surprised to learn that python closes over variables by name.

                1.  

                  I think the ‘reference type’ terminology is almost always the wrong way of reasoning about how variables work, especially in languages that don’t have types, like Python.

                  1.  

                    Python doesn’t have static types (by default) but it definitely has types.

                    1.  

                      It depends on the semantics of types you’re referring to. In type theory it is about types at compilation type. In this case, Python has just one type, basically PyObject and is thus referred as unityped. On the other hand, it has tagged values at runtime. This is in contrast to many “typed” languages, where types exist at compilation but it the runtime they are erased and there is no way to get the type of a value at runtime.

                  2.  

                    A bit clearer statement of what I think the other reply tried to say (or, perhaps, should have said): the question is really a category error, because Python is neither a pass-by-value nor a pass-by-reference language.

                    A closer approximation of the right question is to ask which types of objects in Python are mutable and which are not, because that gives a more reliable prediction of whether mutations which occur in a function call will be visible to outer scopes.

            1. 8

              Author here.

              1. 3

                Thanks for the post it really helped me understand what was going on as I’ve stopped following the reports during R5RS and never caught up with R6RS and R7RS.

                1. 3

                  Excellent post! Thanks for writing it. Just wanted to recommend that you should mention you’re specifically talking about R7RS-small earlier in the post. Things might get a bit confusing when R7RS-large comes out.

                  1. 3

                    Thank you, that’s a good suggestion.

                  2. 3

                    Do you think R7RS-Large will be a game changer? Or will R6RS continued to be seen as “a full solution” you think?

                    1. 3

                      R7RS-large is IIUC larger than R6RS, already. And yes, according to me it is a game changer. Sadly C FFI is not part of it.

                      1. 2

                        For the R6RS implementations that have a built-in FFI, a portable C FFI is available in r6rs-pffi (as you of course know). In what sense is R7RS-large a game changer, do you think?

                        1. 1

                          R7RS-large promotes good coding practice with hygenic macros, a better exception story, and the inclusion of several foundational libraries like SRFI-41, SRFI-128, generators and accumulators. I miss CFFI, SRFI-145 assume as a type hint facility, and some network libraries including HTTP and websocket. Also a better port story would be nicer. I guess the predicate approach to exceptions does not please every one but I like it, so far.

                          I am good with the fact that there is no OOP, but I might change my mind, even when programming GUI I do not use OOP anymore.

                      2. 1

                        It would be better if someone else answers about R7RS-large; I’m out of touch with the standardization effort and haven’t even checked what the scope and the vision is. “Large” as such is not so appealing to me. But what I think will be a game changer is if we start to get more standards like SRFI 170 (POSIX API). R7RS-large is pushing for more things like this, which is really good. I doubt that R6RS will be supplanted by R7RS-large because there are even those who still prefer R4RS and R5RS.

                        1. 1

                          If large isn’t appealing to you, is that not the point of R7RS-small?

                          1. 2

                            Exactly. The way I understand it is that R7RS-small and R7RS-large were set up in a way that those who like small would have R7RS-small and those who like large would have R7RS-large. This way both parts of the community would be pleased by R7RS. I disagree with the assumptions behind that setup and I don’t think it will have the intended effect, because that is not where the disagreement really was. I don’t think we have a part of the community that wants a large language and a different part that wants a small one. There is more to it than large or small, and even those are relative concepts.

                            1. 2

                              It seems pretty clear to me that the community is split down the middle between people that want something like R6RS and people that want something like R5RS. I’d also suggest that’s the received wisdom in the community. Why is it that you disagree?

                              1. 1

                                Where do you think the disagreement was?

                      1. 4

                        I will experiment with ideas from unison.

                        1. 8

                          I will actually make it to the very end of SICP, register machines and all.

                          Then try a non-trivial thing in Racket.

                          1. 3

                            Awesome! Racket is the first language I will learn some years from now when I attain Journeyman level in Python.

                            I’m very fascinated by both the language itself and the rich deep ecosystem that exists around it. Really impressive stuff!

                            1. 1

                              Why delay? It’s sufficiently different that I don’t think learning racket will interfere with improving python.

                              1. 2

                                Because I have found that when I’m trying to learn something as complex as a programming language, simultaneously cramming other syntaxes and paradigms into my head lessens my ability to master the one I’m currently working on and with. I just wrote a blog post about this, posted under separate cover :)

                                As I’ve said elsewhere, this isn’t forever, but I do need to rein myself in long enough to get out of the hole I’ve dug for myself.

                            2. 3

                              Try nanopass framework and compite to wasm!

                              1. 3

                                Since the David Beazley talk posted here a few weeks ago where he wrote a wasm interpreter in python during the talk, I have been keen to play with it. I shall give this a go - thank you for the recommendation!

                                1. 4

                                  Since the David Beazley talk posted

                                  I missed that. Can you post a link please?

                            1. 15

                              I will learn:

                              • More number theory and error analysis so that I can implement the Elusive Eight.
                              • More about BATMAN and mesh networking, so that I can keep improving my home network.
                              • More about implementation of databases so that I can implement a proper categorical database system.
                              • More about Z3’s internals. I think that I have an improvement on the state of the art for 3-SAT but I’m not sure yet because I haven’t grokked every internal representation of Z3.
                              • To get better at proposing simple natural arguments which infuriate bigots, so that I can more effectively create self-doubt and insecurity amongst fascists.
                              • One additional algorithm for a non-standard Rubik’s Cube. Probably parity fixes for 4x4/5x5 or last-layer for Megaminx.
                              • To keep Venus flytraps alive. Surprisingly picky plants, and I don’t have a green thumb.
                              1. 4
                                • More about implementation of databases so that I can implement a proper categorical database system.

                                Can you tell me more about “categorical database system”? I stumbled upon http://math.mit.edu/~dspivak/informatics/talks/CTDBIntroductoryTalk it looks interesting. Thanks!

                                1. 5

                                  Imagine a database that is not built on relational logic, but on categorical logic. Imagine not just graph databases, but databases which store hypergraphs with path equivalence; that is, databases in which categories are the objects being searched and stored.

                                  Alternatively, imagine a language for expressing categorical ideas. I keep coming back to Hagino CPL, a language in which one writes lengthy categorical expressions, and retrieves a canonicalized shortened categorical expression.

                                2. 2

                                  More about BATMAN and mesh networking, so that I can keep improving my home network.

                                  Are you using mesh network at home? Which devices are you using for it? Is there a real advantage using a mesh network at home instead that using a traditional network?

                                  1. 2

                                    More about Z3’s internals.

                                    Z3?

                                    1. 7

                                      The Z3 Theorem Prover, an efficient SMT (Satisfiability Modulo Theories) solver very popular and widely used in Formal Methods and PLT (Programming Language Theory) research communities.

                                      Programming Z3 is a nice tutorial with references to other great resources about Z3.

                                      1. 11

                                        A roadster built by BMW in the 90’s and early 2000’s. I also have a somewhat broken one that I need to learn more about it’s internals to get it roadworthy again.

                                        1. 1

                                          A SMT/SAT solver by Microsoft

                                        2. 1

                                          3-SAT is, as far as I can tell, mostly a theoretical device. SAT solver implementations deal with arbitrary clauses (but have special optimizations for 2- and sometimes 3- clauses). I’d recommend looking at minisat/glucose/cadical rather than Z3 if you’re into pure SAT because Z3 is a SMT solver and is literally orders of magnitudes more complex than a SAT solver.

                                          1. 1

                                            To keep Venus flytraps alive. Surprisingly picky plants, and I don’t have a green thumb.

                                            I was endlessly fascinated by these as a young man and killed a great succession of them, probably due to over-feeding.

                                            1. 1

                                              To get better at proposing simple natural arguments which infuriate bigots, so that I can more effectively create self-doubt and insecurity amongst fascists.

                                              This is something I’ve been thinking about for a while as well. Do you think they are open to the voice of reason/argument?

                                            1. 2

                                              I ported my triple store to Chez Scheme. I did some microbenmarks. It is faster to import wikidata-lexemes (5.6GB) by 11%, and the first query (cold cache and very simple query) is 10 times faster. I should prolly automate those benchmarks.

                                              1. 5

                                                Everything in there applies to Scheme but it is much more easier. Learn everything but call/cc and GOOPS. When you need Object Oriented code rely on GOOPS. When you need more syntactic sugar or performance looks into advanced macro system. Eventually, read on nanopass framework, for most advanced use cases.

                                                1. 2

                                                  This sort of complexity trade-off makes me wonder if there is some way to embed database query optimization while working with collections …

                                                  That is the kind of things that is allowed by SRFI-167 That is you can work with an in-memory implementation (the sample implementation). At the end of the day it is only a tree, but the procedure that are exposed (inspired from FoundationDB) are much more explicit about how to compose those procedure to build bigger / higher abstractions.

                                                  Also, I plan to use SRFI-167 and SRFI-168 as the store in a ReactJS application, that is a purely in memory use-case.

                                                  1. 5

                                                    The true distributable form for Linux software, and rather for Unix software in general, is a .tar.gz file containing the source code.

                                                    I have tried several times to learn how to create .deb packages and I immediately unlearned it. I am glad to gnu guix is much simpler in this regard.

                                                    And, yes I package my own software, in my own channel and binaries substitutes.

                                                    I recognize there is chicken-egg problem here: no distribution <=> no users.

                                                    Again guix helps, because users can install in their profile whatever they want and it can not hurt other users.

                                                    1. 5

                                                      L-systems are seemingly simple and creates a powerful framework for describing shapes. Sadly, I never encountered it during my programming experiments or in production. It is probably useful for generative art. I created a vm for libfive that translated some kind of L-system into a 3d shape.

                                                      1. 3

                                                        This week-end I created a small quick-win database server application based on my previous work on SRFI-167 (okvs) and SRFI-168 (nstore). The goal is to make querying wikidata super-duper-quick-and-easy. I dubbed that program nomunofu. It is far from complete e.g. it does not support RDF gensyms which means some input triples are ignored. After the release of v0.1.0, I created a portable binary with GNU Guix (not released yet), and rented a storage server at online.net. I am on my way to import all-the-triples from wikidata (around 9B triples which amount to approximately 1TB).

                                                        The idea I am perusing, is to have a “simple” database server (mostly done), and a smart and thick Python client where the actual query logic happens. That way, it off-loads the server from heavy computations, and make it possible client-side to more easily workaround bugs in the data.

                                                        This week, I will improve the Python client, to support SPARQL and think about some function combinators that have similar functionality to SPARQL, but that is embedded in Python which should be easier to debug and customize.

                                                        1. 1

                                                          The default environment being DEV put the project at risk, in the sense that when someone will try, for some reason, to spin the app in production environment it might break things in difficult ways, whereas making production default, will just fail fast.

                                                          Also, this article does not even touch the subject of distributed secret sharing. This is an approach that works with a single app, single service monolith, but does not scale to multiple services and distributed settings.

                                                          1. 1

                                                            Yep, that’s noted a few times in the post.

                                                          1. 1

                                                            I make progress on my search engine. Today and next few days I will work on the crawler.

                                                            1. 3

                                                              I finalized SRFI-167 and SRFI-168. Before continuing my peer-to-peer work (I know that is a long shot), I will cycle back to my search engine that wants to be federated, that can run on small machines (my target is a one or more TB of SSD and around 16GB of RAM and 8 cores, that may evolve depending on what I can mid-range hardware (around 600euros). My dream is to run on open-hardware or at least SOC kind of stuff). Still using Scheme programming language, but this time GNU Guile. I will re-use SRFI-167, SRFI-168 and scavenge past and established projects. The idea, is that I can not build a new paradigm (social network on peer-to-peer database) and ignore the vast amount of knowledge that is in the www. A memex for the web era.

                                                              I am reading about Tim Berners-Lee solid project.

                                                              I am very happy I finalized the SRFIs, and I know there is much more ahead.

                                                              1. 4

                                                                I’m really excited about using this to decouple databases from their query languages. The database could expose tables and indices via a wasm api and the client could compile whatever query language it likes into a wasm template and install it. It would finally open up the narrow waist of SQL to competition.

                                                                1. 1

                                                                  This is a good use case for wasm. Even if I believe the future of databases is Ordered Key-Value Stores (OKVS).

                                                                  1. 1

                                                                    An Ordered Key-Value store that can send wasm to the data could expose a solid SQL interface client-side. Most worst-case optimal join algorithms only need ordered indexes.

                                                                1. 4

                                                                  Merkle not Merkel tree.

                                                                  1. 1

                                                                    Thank you.

                                                                  1. 1

                                                                    This is not a serious overview of fibers or async / await.

                                                                    1. 1

                                                                      Compared to?

                                                                    1. 3

                                                                      I want to finalize SRFI-167 and SRFI-168. Ported the code to Chibi Scheme and improved the (sample) in-memory implementation. I preparing an interview. Also I will probably work on peer-to-peer. Or maybe do improve my function-based reactjs state manager https://github.com/amirouche/ff.js

                                                                      1. 8

                                                                        Still working on SRFI-167 and SRFI-168, but also some kind of peer-to-peer distributed database see https://github.com/scheme-live/peer-to-peer