Skip to main content
Tweeted twitter.com/StackMma/status/1262533438105702404
Became Hot Network Question
deleted 16 characters in body
Source Link
LeafGlowPath
  • 1.5k
  • 8
  • 11

I know that I can convert an expression to list by

List @@ expr

But this does not work if expr contains only one termis atomic, e.g.,

List @@ 1

will give you 1 instead of {1}. Of course I can check the length of expr first. But I wonder if there is simpler way to do this.

I know that I can convert an expression to list by

List @@ expr

But this does not work if expr contains only one term, e.g.,

List @@ 1

will give you 1 instead of {1}. Of course I can check the length of expr first. But I wonder if there is simpler way to do this.

I know that I can convert an expression to list by

List @@ expr

But this does not work if expr is atomic, e.g.,

List @@ 1

will give you 1 instead of {1}. Of course I can check the length of expr first. But I wonder if there is simpler way to do this.

Source Link
LeafGlowPath
  • 1.5k
  • 8
  • 11

Simple way to convert expression to a list?

I know that I can convert an expression to list by

List @@ expr

But this does not work if expr contains only one term, e.g.,

List @@ 1

will give you 1 instead of {1}. Of course I can check the length of expr first. But I wonder if there is simpler way to do this.