question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating a comma-separated list of space-separated lists — erroneus append() behavior

See original GitHub issue

I’m trying to create a comma-separated list of space-separated lists with append().

I expect to get the following meta-list: ( (1 2), (3 4) ).

The problem is that append() breaks the first sub-list, producing ( 1, 2, (3 4) ).

$meta-list: append( ((1 2)), (3 4), comma)
@warn $meta-list
// WARNING: 1, 2, 3 4

@warn nth($meta-list, 1)
// WARNING: 1

// Just to make sure:
@warn @warn nth( ( (1 2), (3 4) ), 1)
//WARNING: 1 2

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
Anahkiasencommented, Apr 7, 2013

Creating a comma-separated list of space-separated lists

Yo dawg I heard you liked lists so we put a list in your list so can loop while you loop.

1reaction
nex3commented, Apr 18, 2013

@lolmaus as @robwierzbowski pointed out, adding an extra set of parentheses doesn’t create an extra level of list nesting. Parentheses aren’t list delimiters; they just group order of operations. ($a) is always the same as $a.

This definitely seems like a bug though — no matter what you do with a single dimensional list, even if it’s explicitly space separated, append() with a comma separator turns it into a comma separated list.

$space-list: join(1, 2, space);
@debug append($space-list, (3 4), comma); // 1, 2, 3 4

This is the expected behavior. From the documentation of append:

If [the $separator argument] is comma or space, that is always the separator; if [it] is auto (the default), the separator is the same as that used by the list.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sass - Creating a comma-separated list of space-separated lists
Okay, i got it. The solution is to create a blank list first. $meta-list: () $meta-list: append( $meta-list, (1 2), comma) $meta-list: ...
Read more >
Comma Separated List - an overview | ScienceDirect Topics
If the server accepts the authentication, it will send a list (comma-separated values) of the “method names” that could fulfill the client's request...
Read more >
change a space delimited list into a comma delimited list with ...
Solved: I am writing a macro that takes in a list and selects records from a dataset with those names. It will look...
Read more >
3. Strings, lists, and tuples — Beginning Python Programming ...
A list containing no elements is called an empty list, and a tuple with no ... when specifiying a tuple, and only use...
Read more >
Splitting, Concatenating, and Joining Strings in Python
If you guessed that .split() is an instance method because strings are a special ... that is used on lists: when you call...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found