Skip to main content

Questions tagged [ragged-list]

A ragged list, also called a jagged list, is a list where each element can either be some terminal type (e.g. an integer) or another ragged list.

23 votes
33 answers
4k views

Lists can contain lists and we have nested lists. But we don't like nested lists and want to flatten them. By flattening I mean create a list which does not contain any list, but elements of lists it ...
Amir reza Riahi's user avatar
21 votes
23 answers
3k views

Given a ragged list, we can define an element's depth as the number of arrays above it, or the amount that it is nested. For example, with the list ...
emanresu A's user avatar
  • 46.8k
22 votes
28 answers
2k views

Add++, the Language of the Month, has the "collect" builtin as BC. Your task is to implement this builtin. Consider a non-empty array, where each element ...
caird coinheringaahing's user avatar
20 votes
12 answers
2k views

Given a ragged array, find the length of the largest subarray that contains the depth of that subarray. The base array layer has a depth of 0. Here is an example: ...
Alan Bagel's user avatar
  • 4,299
23 votes
24 answers
1k views

Given a ragged list of positive integers find the size of the largest list contained somewhere in it. For example: [1,[1,[8,2,[1,2],5,4,9]],2,[],3] Here the answer ...
Wheat Wizard's user avatar
  • 104k
40 votes
12 answers
3k views

Imagine a very simple language. It has just 2 syntax features: () indicates a block scope, and any word consisting only of 1 or more lower case ASCII letters, which ...
mousetail's user avatar
  • 14.5k
27 votes
18 answers
1k views

hgl has a "scan" function called sc. What it does in general is a little bit abstract, so we will just talk about one specific way you can use it. If we ...
Wheat Wizard's user avatar
  • 104k
18 votes
26 answers
2k views

Given a string like [[[],[[]]],[]], made of only commas and square brackets, your challenge is to determine whether it represents a list. A list is either: ...
emanresu A's user avatar
  • 46.8k
39 votes
55 answers
12k views

A simple challenge for your Monday evening (well, or Tuesday morning in the other half of the world...) You're given as input a nested, potentially ragged array of positive integers: ...
Martin Ender's user avatar
22 votes
24 answers
3k views

Say I have a ragged list, like: [ [1, 2], [3, [4, 5] ] ] And I want to iterate over each item and delete it one-by-one. However, I don't know the ...
emanresu A's user avatar
  • 46.8k
42 votes
48 answers
6k views

Background Inspired by Octave's (and, by extension, MATL's) very convenient interpretation of truthy/falsy matrices, Jelly got the Ȧ (Octave-style all) atom. Ȧ takes an array as input and returns 1 ...
Dennis's user avatar
  • 212k
19 votes
20 answers
959 views

As input you will be given a ragged list of positive integers containing at least one integer at some level. For example: [[],[[1,2,[3]]],[]] You should output ...
Wheat Wizard's user avatar
  • 104k
31 votes
18 answers
3k views

Related but different. Part II Taken from the book: Marvin Minsky 1967 – Computation: Finite and Infinite Machines, chapter 14. Background As the Gödel proved, it is possible to encode with a unique ...
lesobrod's user avatar
  • 3,448
16 votes
10 answers
2k views

In Haskell (and probably some other languages or something) zip is a function which takes two lists, and produces a list of tuples by pairing elements at the same ...
Wheat Wizard's user avatar
  • 104k
18 votes
21 answers
3k views

Create a function (or closest equivalent, or full program) that takes an list of some datatype (your choice) that may be nested and a string (in either order), and generalizes the lisp c[ad]+r ...
Wezl's user avatar
  • 1,506

15 30 50 per page