Planet Scheme

October 18, 2019

Programming Praxis

Anagrams, Again

The previous exercise showed a probabilistic method for determining if two strings are anagrams, and some users pointed out collisions in the method that falsely concluded two strings were anagrams when in fact they were not.

Your task is to write a program that recognizes anagrams without possibility of error. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at October 18, 2019 09:00 AM

October 17, 2019

GNU Guix

Insecure permissions on profile directory (CVE-2019-18192)

We have become aware of a security issue for Guix on multi-user systems that we have just fixed (CVE-2019-18192). Anyone running Guix on a multi-user system is encouraged to upgrade guix-daemon—see below for instructions.

Context

The default user profile, ~/.guix-profile, points to /var/guix/profiles/per-user/$USER. Until now, /var/guix/profiles/per-user was world-writable, allowing the guix command to create the $USER sub-directory.

On a multi-user system, this allowed a malicious user to create and populate that $USER sub-directory for another user that had not yet logged in. Since /var/…/$USER is in $PATH, the target user could end up running attacker-provided code. See the bug report for more information.

This issue was initially reported by Michael Orlitzky for Nix (CVE-2019-17365).

Fix

The fix consists in letting guix-daemon create these directories on behalf of users and removing the world-writable permissions on per-user.

For cluster setups where clients connect to the daemon over TCP (thanks to the --listen option of guix-daemon), the fix requires guix-daemon to be able to resolve user names so that it can create /var/…/per-user/$USER with the right ownership. Note also that the guix command prior to this fix would not communicate the user name it’s running under to the daemon, thereby preventing it from creating that directory on its behalf.

Upgrading

On multi-user systems, we recommend upgrading the daemon now.

To upgrade the daemon On Guix System, run:

guix pull
sudo guix system reconfigure /etc/config.scm
sudo herd restart guix-daemon

On other distros, run something along these lines:

sudo guix pull
sudo systemctl restart guix-daemon.service

Once you’ve run guix build hello or any other guix command, you should see that /var/guix/profiles/per-user is no longer world-writable:

$ ls -ld /var/guix/profiles/per-user
drwxr-xr-x 5 root root 4096 Jun 23  2017 /var/guix/profiles/per-user

Please report any issues you may have to guix-devel@gnu.org. See the security web page for information on how to report security issues.

About GNU Guix

GNU Guix is a transactional package manager and an advanced distribution of the GNU system that respects user freedom. Guix can be used on top of any system running the kernel Linux, or it can be used as a standalone operating system distribution for i686, x86_64, ARMv7, and AArch64 machines.

In addition to standard package management features, Guix supports transactional upgrades and roll-backs, unprivileged package management, per-user profiles, and garbage collection. When used as a standalone GNU/Linux distribution, Guix offers a declarative, stateless approach to operating system configuration management. Guix is highly customizable and hackable through Guile programming interfaces and extensions to the Scheme language.

by Ludovic Courtès at October 17, 2019 10:15 PM

October 15, 2019

Programming Praxis

Prime Anagrams

There are many algorithms for recognizing anagrams. Here is an unusual one:

Assign each character to a prime number, then map a string to the corresponding primes, and compute their product. Two strings are anagrams only if they share a product.

Your task is to use prime numbers to recognize anagrams. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at October 15, 2019 09:00 AM

October 11, 2019

Programming Praxis

A Scrambled Words Variant

In the previous exercise, we wrote a program to scramble the letters in each word of a string, retaining capitalization and punctuation: “Programming Praxis is fun!” became something like “Grprnimaogm Srxpia is unf!” Today’s exercise is the same, but with a simple variation: the first and last letters of each word must remain unchanged, so we might see something like “Prgrnimaomg Prxias is fun!”

Your task is to modify your previous program in the minimal possible way into a program that scrambles the letters in the interior of the words in a string, retaining capitalization and punctuation. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at October 11, 2019 09:00 AM

October 08, 2019

Programming Praxis

Scrambled Words

Given a string, scramble the letters of each word individually, where a word is a maximal sequence of letters, maintaining the original capitalization and punctuation. For instance, the string “Programming Praxis is fun!” might be scrambled as “Grprnimaogm Srxpia is unf!”

Your task is to write a program to scramble the letters of each word in a string. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at October 08, 2019 09:00 AM

GNU Guix

Guix Reduces Bootstrap Seed by 50%

We are delighted to announce that the first reduction by 50% of the Guix bootstrap binaries has now been officially released!

This is a very important step because the ~250MB seed of binary code was practically non-auditable, which makes it hard to establish what source code produced them.

Every unauditable binary also leaves us vulnerable to compiler backdoors as described by Ken Thompson in the 1984 paper Reflections on Trusting Trust and beautifully explained by Carl Dong in his Bitcoin Build System Security talk.

It is therefore equally important that we continue towards our final goal: A Full Source bootstrap; removing all unauditable binary seeds.

Guix’ Rigorous Regular Bootstrap

GNU Guix takes a rigorous approach to bootstrapping. Bootstrapping in this context refers to how the distribution gets built from nothing.

The GNU system is primarily made of C code, with glibc at its core. The GNU build system itself assumes the availability of a Bourne shell and command-line tools provided by the Core GNU Utilities and Awk, Grep, Make, Sed, and some others.

The build environment of a package is a container that contains nothing but the package’s declared inputs. To be able to build anything at all in this container, Guix needs pre-built binaries of Guile, GCC, Binutils, glibc, and the other tools mentioned above.

So there is an obvious chicken-and-egg problem: How does the first package get built? How does the first compiler get compiled?

                            gcc-final
                                ^
                                |
                          cross-gcc-boot
                                ^
                                |
                        gcc-boot0 (5.5.0)
                                ^
                                |
                 binutils-boot0, libstdc++-boot0
                                ^
                                |
           diffutils-boot0, findutils-boot0, file-boot0
                                ^
                                |
                           make-boot0
                                ^
                                |
                                *
        bootstrap-binutils, bootstrap-gcc, bootstrap-glibc (~130MB)
      bootstrap-bash, bootstrap-coreutils&co, bootstrap-guile (~120MB)

full graph

The answer to this starts with bootstrap binaries. The first package that gets built with these bootstrap binaries is make, next are diffutils, findutils, and file. Eventually a gcc-final is built: the compiler used to build regular packages.

i686/x86_64 Reduced Binary Seed bootstrap

The Guix development branch we just merged introduces a reduced binary seed bootstrap for x86_64 and i686, where the bottom of the dependency graph looks like this:

                         gcc-mesboot (4.9.4)
                                ^
                                |
                        glibc-mesboot (2.16.0)
                                ^
                                |
                         gcc-mesboot1 (4.7.4)
                                ^
                                |
                        binutils-mesboot (2.20.1a)
                                ^
                                |
                         gcc-mesboot0 (2.95.3)
                                ^
                                |
                         glibc-mesboot0 (2.2.5)
                                ^
                                |
                        gcc-core-mesboot (2.95.3)
                                ^
                                |
    make-mesboot0, diffutils-mesboot, binutils-mesboot0 (2.20.1a)
                                ^
                                |
                            tcc-boot
                                ^
                                |
                            tcc-boot0
                                ^
                                |
                            mes-boot
                                ^
                                |
                                *
              bootstrap-mescc-tools, bootstrap-mes (~10MB)
      bootstrap-bash, bootstrap-coreutils&co, bootstrap-guile (~120MB)

full graph

The new Reduced Binary Seed bootstrap removes Binutils, GCC, and glibc and replaces them by GNU Mes and MesCC Tools. This reduces the trusted binary seed by ~120MB - half of it!

As a user, it means your package manager has a formal description of how to build all your applications, in a reproducible way, starting from nothing but this ~120MB seed. It means you can rebuild any of those software artifacts locally without trusting a single binary provider.

For comparison, traditional distros often have an informally specified bootstrap story, usually relying on much bigger binary seeds. We estimate those seeds to weigh in at ~550MB (the size of debootstrap --arch=i386 --include=build-essential,dpkg-dev,debhelper,gcc,libc6-dev,make,texinfo bullseye ./bullseye-chroot http://deb.debian.org/debian, with bullseye-chroot/var/cache/apt/archives removed) in the case of Debian—ignoring cycles that show up higher in the graph.

These bootstrap binaries can now be re-created by doing

    guix build bootstrap-binaries

Work started three years ago with a simple LISP-1.5 interpreter.

A year later, Mes 0.5 had become a tiny Scheme interpreter written in simple subset of C that came with a simple C compiler in Scheme. And yes, these were mutual self-hosting.

The next step was to find a path towards compiling Guix’s default GCC (5.5.0). Sadly, bootstrapping GCC compilers has been becoming increasingly difficult over the years. We looked at GCC 1.42: not easy to bootstrap (100,000 LOC) and it depends on Bison. Reluctantly, we started looking for non-GNU alternatives 8cc, pcc, cc500 but finally settled on TinyCC. TinyCC (TCC) can compile GCC (4.7.4) which is currently the most recent release of GCC that can be built without a C++ compiler.

Another year later, Mes 0.13 has grown its own tiny C library and compiles a heavily patched and simplified TCC. This looked very promising and we suggested for TinyCC to help our bootstrapping effort by moving towards a simplified C subset. Instead we were encouraged to make MesCC a full blown C99 compliant compiler. That felt as a setback but it gave us the perspective of removing TCC from the bootstrap later on. Using Nyacc, the amazing parser framework with C99 parser by Matt Wette, has even made that a feasible perspective.

It took only half a year to mature into Mes 0.19 so that building TinyCC (25,000 LOC) now only takes ~8min instead of the initial 5h.

With a bootstrapped TCC we tried building some versions of GCC (1.4, 2.6.3, 2.95.3, 3.0, 3.1, 3.2.3, 3.4.0, 3.4.6, 4.1.1, 4.1.2) to try to build some versions of glibc (1.06.4, 1.09.1, 2.0.1. 2.1.3, 2.3, 2.3.6, 2.2.5, 2.12.2, 2.15, 2.16.0, 2.28) using slightly less versions of Binutils (1.9, 2.5.1, 2.5.2, 2.6, 2.7, 2.10.1, 2.14, 2.14a, 2.15a, 2.17a, 2.18a, 2.20.1a, 2.23.2, 2.25, 2.28). There were many interesting dependencies, tradeoffs, patching of generated Autotools outputs, especially if you are using your own tiny C library and headers.

Typically, newer versions of the tool chain fix all kinds of bugs in the build system and C code compliance, which is great. However, simultaneously new features are introduced or dependencies are added that are not necessary for bootstrapping, increasing the bootstrap hurdle. Sometimes, newer tools are more strict or old configure scripts do not recognise newer tool versions.

Also, can you spot the triplets of tool versions that combine into integral versions of the tool chain? ;-)

Scheme-only Bootstrap

Our next target will be another reduction by ~50%; the Scheme-only bootstrap will replace the Bash, Coreutils, etc. binaries by Gash and Gash Core Utils.

Gash is a work-in-progress implementation of a POSIX shell in Scheme, that is already capable-enough to interpret Autoconf-generated configure scripts. It can run on Guile but it is designed to also run on Mes, meaning that we can use it early on during bootstrap.

We are excited that the Nlnet Foundation is now sponsoring this work!

Creating a GNU Tool Chain Bootstrap Story

The Reduced Binary Seed bootstrap starts by building ancient GNU software, notably GCC (2.95.3), glibc (2.2.5).

This amazing achievement is mirrored only by its terrible clumsiness. Is this really how we want to secure the bootstrap of our GNU system?

                         gcc-mesboot (4.6.4)
                                ^
                                |
                            tcc-boot
                                ^
                                |
                            mes-boot
                                ^
                                |
                                *

Maybe if we could go straight from TinyCC to GCC (4.6.4) we need no longer depend on an ancient GNU tool chain and have a somewhat more modern and more maintainable bootstrap path.

Now that we have shown it can be done, we think it is time for GNU tool chain developers to step in and help create a better version of our tool chain bootstrap story.

Towards a Full Source Bootstrap

We expect many interesting challenges before we approach this lofty target.

The stage0 project by Jeremiah Orians starts everything from ~512 bytes; virtually nothing. Have a look at this incredible project if you haven’t already done so.

Jeremiah is also leading the Mes-M2 effort that is about bootstrapping Mes from stage0. The Mes Scheme interpreter is being rewritten in an even more simple subset of C, without preprocessor macros even. That C-like language is called M2-Planet, after its transpiler.

About Bootstrappable Builds and GNU Mes

Software is bootstrappable when it does not depend on a binary seed that cannot be built from source. Software that is not bootstrappable - even if it is free software - is a serious security risk for a variety of reasons. The Bootstrappable Builds project aims to reduce the number and size of binary seeds to a bare minimum.

GNU Mes is closely related to the Bootstrappable Builds project. Mes aims to create an entirely source-based bootstrapping path for the Guix System and other interested GNU/Linux distributions. The goal is to start from a minimal, easily inspectable binary (which should be readable as source) and bootstrap into something close to R6RS Scheme.

Currently, Mes consists of a mutual self-hosting scheme interpreter and C compiler. It also implements a C library. Mes, the scheme interpreter, is written in about 5,000 lines of code of simple C. MesCC, the C compiler, is written in scheme. Together, Mes and MesCC can compile a lightly patched TinyCC that is self-hosting. Using this TinyCC and the Mes C library, it is possible to bootstrap the entire Guix System for i686-linux and x86_64-linux.

About GNU Guix

GNU Guix is a transactional package manager and an advanced distribution of the GNU system that respects user freedom. Guix can be used on top of any system running the kernel Linux, or it can be used as a standalone operating system distribution for i686, x86_64, ARMv7, and AArch64 machines.

In addition to standard package management features, Guix supports transactional upgrades and roll-backs, unprivileged package management, per-user profiles, and garbage collection. When used as a standalone GNU/Linux distribution, Guix offers a declarative, stateless approach to operating system configuration management. Guix is highly customizable and hackable through Guile programming interfaces and extensions to the Scheme language.

by Jan Nieuwenhuizen at October 08, 2019 12:00 AM

October 07, 2019

GNU Guix

Joint statement on the GNU Project

We, the undersigned GNU maintainers and developers, owe a debt of gratitude to Richard Stallman for his decades of important work in the free software movement. Stallman tirelessly emphasized the importance of computer user freedom and laid the foundation for his vision to become a reality by starting the development of the GNU operating system. For that we are truly grateful.

Yet, we must also acknowledge that Stallman’s behavior over the years has undermined a core value of the GNU project: the empowerment of all computer users. GNU is not fulfilling its mission when the behavior of its leader alienates a large part of those we want to reach out to.

We believe that Richard Stallman cannot represent all of GNU. We think it is now time for GNU maintainers to collectively decide about the organization of the project. The GNU Project we want to build is one that everyone can trust to defend their freedom.

  1. Ludovic Courtès (GNU Guix, GNU Guile)

  2. Ricardo Wurmus (GNU Guix, GNU GWL)

  3. Matt Lee (GNU Social)

  4. Andreas Enge (GNU MPC)

  5. Samuel Thibault (GNU Hurd, GNU libc)

  6. Carlos O'Donell (GNU libc)

  7. Andy Wingo (GNU Guile)

  8. Jordi Gutiérrez Hermoso (GNU Octave)

  9. Mark Wielaard (GNU Classpath)

  10. Ian Lance Taylor (GCC, GNU Binutils)

  11. Werner Koch (GnuPG)

  12. Daiki Ueno (GNU gettext, GNU libiconv, GNU libunistring)

  13. Christopher Lemmer Webber (GNU MediaGoblin)

  14. Jan Nieuwenhuizen (GNU Mes, GNU LilyPond)

  15. John Wiegley (GNU Emacs)

  16. Tom Tromey (GCC, GDB)

  17. Jeff Law (GCC, Binutils — not signing on behalf of the GCC Steering Committee)

  18. Han-Wen Nienhuys (GNU LilyPond)

  19. Joshua Gay (GNU and Free Software Speaker)

  20. Ian Jackson (GNU adns, GNU userv)

  21. Tobias Geerinckx-Rice (GNU Guix)

  22. Andrej Shadura (GNU indent)

  23. Zack Weinberg (developer on GCC, GNU libc, GNU Binutils)

  24. John W. Eaton (GNU Octave)

  25. Jonathan Wakely (developer on GCC)

  26. Siddhesh Poyarekar (developer on GNU libc)

  27. Damian Rouson (developer on GFortran)

  28. David Malcolm (developer on GCC)

  29. Maciej W. Rozycki (developer on GCC, GDB, GNU Binutils, GNU libc)

by A collective of GNU maintainers at October 07, 2019 04:15 PM

October 05, 2019

GNU Guix

GNU Guix maintainer collective expands

In July, we—Ricardo Wurmus and Ludovic Courtès—called for volunteers to join us in maintaining Guix. We are thrilled to announce that three brave hackers responded and that they’re now officially co-maintainers! The Guix maintainer collective now consists of Marius Bakke, Maxim Cournoyer, and Tobias Geerinckx-Rice, in addition to Ricardo and Ludovic. You can reach us all by email at guix-maintainers@gnu.org, a private alias.

So what does it mean to be a maintainer? There are some duties:

  1. Enforcing GNU and Guix policies, such as the project’s commitment to be released under a copyleft free software license (GPLv3+) and to follow the Free System Distribution Guideline (FSDG).

  2. Enforcing our code of conduct: maintainers are the contact point for anyone who wants to report abuse.

  3. Making decisions, about code or anything, when consensus cannot be reached. We’ve probably never encountered such a situation before, though!

Maintainers should have a good idea of what’s going on, but the other responsibilities can (and should! :-)) be delegated. Maybe you, dear reader, can help on one of them? Here are some examples:

  • Making releases. Any experienced developer can take this responsibility for some time.

  • Dealing with development and its everyday issues as well as long-term roadmaps, branch merges, code review, bug triage, all that.

  • Participating in Outreachy and Google Summer of Code (GSoC).

  • Organizing the Guix Days before FOSDEM and our presence at FOSDEM and other conferences.

  • Taking care of Guix money kindly donated by dozens of people and held at the FSF. A Spending Committee currently consisting of Tobias, Ricardo, and Ludovic, is responsible for deciding on, well, what to spend money on. Maintainers should also keep in touch with the “Guix Europe” non-profit registered in France, currently spearheaded by Manolis Ragkousis and Andreas Enge, and which has been providing financial support for hardware and events.

  • Keeping the build farm infrastructure up and running, extending it, thinking about hosting issues, etc.

  • Keeping the web site up-to-date.

  • Looking after people: making sure to promote people who are very involved in leadership position; dubbing new committers, new maintainers, new members of the spending committee. Supporting new initiatives. Generally trying to make sure everyone’s happy. :-)

With now five people on-board, we’ll probably be able to improve some of our processes and be able to scale better. You’re welcome to share your ideas on guix-devel@gnu.org or directly at guix-maintainers@gnu.org!

More generally, we think rotating responsibilities is a great way to bring new ideas and energy into the project. We are super happy and grateful that Maxim, Marius, and Tobias are taking on this challenge—thank you folks!

About GNU Guix

GNU Guix is a transactional package manager and an advanced distribution of the GNU system that respects user freedom. Guix can be used on top of any system running the kernel Linux, or it can be used as a standalone operating system distribution for i686, x86_64, ARMv7, and AArch64 machines.

In addition to standard package management features, Guix supports transactional upgrades and roll-backs, unprivileged package management, per-user profiles, and garbage collection. When used as a standalone GNU/Linux distribution, Guix offers a declarative, stateless approach to operating system configuration management. Guix is highly customizable and hackable through Guile programming interfaces and extensions to the Scheme language.

by Ludovic Courtès, Ricardo Wurmus at October 05, 2019 02:30 PM

October 04, 2019

Programming Praxis

Neatly Printing A CSV File

Today’s exercise can be either simple or complex, depending on how you define it.

The task is to write a program to neatly print a CSV file. Define “neatly” however you wish. The CSV format has inherently variable-width columns, but you should print the columns neatly aligned. Pages should have headers and footers. Add other features as you wish.

Your task is to write a program to neatly print a CSV file. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at October 04, 2019 09:00 AM

October 02, 2019

Göran Weinholt

A New R6RS Scheme Compiler

Some readers already know this and a few have suspected. I’ve been working on a new R6RS Scheme compiler for a while. Now I have released it as free software. Read on to learn the many wonderful drawbacks of this niche compiler.

I will start with what many will find to be the largest drawback, so that those of you who don’t want it can close this tab right away and never look back (but don’t close the tab!). The compiler is licensed under the GNU Affero General Public License, version 3 or later. I chose this license, not only to promote chaos and disorder, but also because of where I see technology and society heading.

With that out of the way, here are some questionable facts about Loko Scheme:

  • You can download it from the Loko Scheme web site.

  • It is written in R6RS Scheme and a wafer thin amount of assembly. Once it has been bootstrapped it can self-compile. There is no C code in the compiler or the runtime.

  • It generates code for the AMD64 instruction set.

  • It has a few optimization passes, such as Fixing Letrec (reloaded), the inliner cp0 (also used in Chez Scheme and Ikarus Scheme) and a low-level instruction level optimizer. Some code runs really fast, but most code runs just okay.

  • It outputs statically compiled binaries only, although there is also an interpreter.

  • The binaries are simultaneously Linux ELF binaries and multiboot binaries for bare hardware.

  • The Linux port of Loko starts in just 3 ms on my machine.

  • It has concurrency based on Concurrent ML with an API surface mostly nicked from fibers for Guile. I/O is non-blocking by default. If you’re familiar with Golang then this part will feel familiar.

  • Most SRFIs from chez-srfi are supported and there’s an early POSIX library for the Linux port based on the current SRFI 170 draft.

Why Loko

Why not? If you can live with the license (which really isn’t as bad as you might think), then Loko is definitely for you. If one looks at how the GPL has worked out for Linux, I think it will be okay. Linux’s license doesn’t extend to user space and I want that aspect to work the same for Loko.

My original use case for Loko Scheme is experimental operating system development. Forget about all legacy software and build your own kernel, with blackjack and hookers, so to speak. Due to the nature of that kind of work, I think it will necessarily be useful for more things.

Suppose that you can compile a Scheme program on your machine and have a guarantee that it will work on all other Linux AMD64 systems. No confusion with glibc vs musl vs whatever. You also have access to non-blocking I/O, a concurrency library and direct syscalls. What can you build with that?

There’s a directory in the Loko repository with the following samples, which might give you an idea of where Loko is today:

  • bga-graphics - this is a simple program that uses the linear framebuffer of the Bochs graphics adapter (available in QEMU), reads a 3D model and renders it on the screen.
  • etherdump - simple driver for an RTL8139 networking chip combined with a text-mode based Ethernet frame dumper.
  • hello - it’s just Hello World as a library, that runs on Linux or on bare hardware (printing to the serial port)
  • lspci - scans the devices on the PCI bus, prints the register locations, IRQs and option ROM sizes, and uses the PCI ID database to print the name of the devices and the vendors
  • web-server - this Linux program sets up a concurrent web server that responds with a static payload. Pretty simplistic code, but not too far away from a working web server. Handles maybe 15k requests per second.

Future direction

In the future I think there will be ports to more kernels, probably NetBSD and FreeBSD, and more instruction sets. I’d like to try to port it to AArch64 myself unless someone gets there before me.

But before that, I will work on more operating system stuff. There’s an experimental USB stack. I’ve got some code that reads a file from a FAT file system on a USB stick, but it’s very slow in its current manifestation. I just recently added a buddy allocator and fibers and just haven’t had time to write more drivers.

Kernel programming with Loko is not as difficult as regular kernel programming. The concurrency model of kernel code is the same as the one for user programs. There is no need to care about writing special code safe for interrupt contexts. If you’re a Scheme programmer then you can probably already do kernel programming with Loko; you just don’t know it yet.

I also want to have user space support in Loko. This would mean you could have a kernel in Scheme that can run regular Unix-like programs. (It’s not a pipe dream either, it’s actually pretty straightforward). This would let you design your own syscall interface for programs. Loko doesn’t really care about what those syscalls do and doesn’t have any opinions about file systems, networking and drivers. If you preferred how file systems worked in TOPS-20, ITS or VMS, then you could make it work that way.

Do not cling to the past. Download Loko and start experimenting today!

Further reading

  • Loko Scheme’s web site has links to downloads and so on.
  • Faster Dynamic Type Checks describes how Loko gets hardware-assisted type checks, so that e.g. a safe car or cdr is a single instruction.
  • Design Your Low-Bit Tagging with Z3Py describes how Loko’s value tagging system is designed (the git repository has the proof code).
  • Akku.scm is the Scheme package manager required when building Loko Scheme. This will also allow for R7RS support in the future. It would already be working, but CI tests for akku-r7rs are currently failing for Loko.

October 02, 2019 12:00 AM

October 01, 2019

GNU Guix

Join GNU Guix through Outreachy

We are happy to announce that for the third time GNU Guix offers a three-month internship through Outreachy, the inclusion program for groups traditionally underrepresented in free software and tech. We currently propose two subjects to work on:

  1. Create Netlink bindings in Guile
  2. Improve internationalization support for the Guix Data Service

If you’d like to contribute to computing freedom, Scheme, functional programming, or operating system development, now is a good time to join us. Let’s get in touch on the mailing lists and on the #guix channel on the Freenode IRC network!

Last year we had the pleasure to welcome Laura Lazzati as an Outreachy intern working on documentation video creation.

About GNU Guix

GNU Guix is a transactional package manager and an advanced distribution of the GNU system that respects user freedom. Guix can be used on top of any system running the kernel Linux, or it can be used as a standalone operating system distribution for i686, x86_64, ARMv7, and AArch64 machines.

In addition to standard package management features, Guix supports transactional upgrades and roll-backs, unprivileged package management, per-user profiles, and garbage collection. When used as a standalone GNU/Linux distribution, Guix offers a declarative, stateless approach to operating system configuration management. Guix is highly customizable and hackable through Guile programming interfaces and extensions to the Scheme language.

by Gábor Boskovits at October 01, 2019 06:00 PM

Programming Praxis

Intersecting Number Wheels

Today’s exercise is a new task from Rosetta Code:

A number wheel has a name which is an uppercase letter and a set of ordered values which are either numbers or names. A number is generated from a named wheel by starting at the first value of the names wheel and advancing through subesquent values then wrapping around to the first value to form a “wheel”, according to the following rules: If the value is a number, yield it; if the value is a name, yield the next value from the named wheel; advance the position of the wheel. For instance, given two wheels A: 1 B 2 and B: 3 4, the sequence generated for wheel A is 1 3 2 1 4 2 1 3 2 1 4 2 ….

Your task is to write a program to calculate the sequences generated by intersecting number wheels. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at October 01, 2019 09:00 AM

September 27, 2019

Programming Praxis

Exercise 6

Today’s task is a beginning programmer’s exercise from Bjarne Stroustrup’s book Programming: Principles and Practice Using C++:

Write a program that prompts the user to enter 3 integer values, and then outputs the values in numerical sequence separated by commas. So: if the user enters the values 10 4 6, the output should be 4, 6, 10. If two values are the same, they should just be ordered together. So, the input 4 5 4 should give 4, 4, 5.

Your task is to write the indicated program; you may use C++ or any other language, but your solution should be at the level of a beginning programmer who has not yet learned about arrays or user-defined functions. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at September 27, 2019 09:00 AM

September 24, 2019

Programming Praxis

Eureka

Somebody’s homework today:

A number is a eureka number if the sum of the powers of its digits, with powers increasing, is equal to the number. For instance, 89 is a eureka number because 8**1 + 9**2 = 89, and 1306 is a eureka number because 1**1 + 3**2 + 6**4 = 1306.

Your task is to write a program to identify eureka numbers, and determine how many eureka numbers exist that are less than a million. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at September 24, 2019 09:00 AM

September 20, 2019

Programming Praxis

What Comes Next?

This is a Microsoft interview question:

What is the next number in the sequence: 8, 13, 17, 22, 24, 26, 29, 31, 35, …?

Your task is to solve the puzzle. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

by programmingpraxis at September 20, 2019 09:00 AM