Ancestors

Toot

Written by Elias Mårtenson on 2025-01-29 at 16:39

I decided to implement a new Kap feature today. It's an implementation of the Range function that is already available is some other array languages.

A simple example: The following expression: 5 … 11 will return a new array: 5 6 7 8 9 10 11. The arguments doesn't have to be scalars. If they are arrays, the prefix and suffixes are preserved:

┌→────────────────────────┐

│10 20 3 4 5 6 7 8 100 200│

└─────────────────────────┘

Of course, this feature also allows you to count down:

┌→───────────┐

│10 9 8 7 6 5│

└────────────┘

None of this are things that was particularly difficult to do before this function was introduced, but it does make writing certain expressions much nicer.

The next step is to add support for character arguments as well. For now, only integers are supported.

Here's a runnable example

=> More informations about this toot | More toots from loke@functional.cafe

Descendants

Written by Karsten Johansson on 2025-01-29 at 18:59

@loke fwiw (and it aint worth much), Google's range is one dot less, like ..

Since you like your code absolutely tiny, I thought I'd mention it.

=> More informations about this toot | More toots from ksaj@infosec.exchange

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113912630844384139
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
257.966126 milliseconds
Gemini-to-HTML Time
0.841465 milliseconds

This content has been proxied by September (3851b).