Skip to main content
Commonmark migration
Source Link

#MATLAB, 23#

MATLAB, 23

 @(n)union(n,n,'stable')

Does the "set union" of the input string with itself, using the 'stable' method which does not sort, and then prints.

This works because union returns only non-duplicate values after the merge. So essentially if you union the string with itself, it first produces a string like Type unique chars!Type unique chars!, and then removes all duplicates without sorting.

No need for unique :)

#MATLAB, 23#

 @(n)union(n,n,'stable')

Does the "set union" of the input string with itself, using the 'stable' method which does not sort, and then prints.

This works because union returns only non-duplicate values after the merge. So essentially if you union the string with itself, it first produces a string like Type unique chars!Type unique chars!, and then removes all duplicates without sorting.

No need for unique :)

MATLAB, 23

 @(n)union(n,n,'stable')

Does the "set union" of the input string with itself, using the 'stable' method which does not sort, and then prints.

This works because union returns only non-duplicate values after the merge. So essentially if you union the string with itself, it first produces a string like Type unique chars!Type unique chars!, and then removes all duplicates without sorting.

No need for unique :)

deleted 6 characters in body
Source Link
Tom Carpenter
  • 4.3k
  • 13
  • 21

#MATLAB, 29#23#

 @(n)disp(union(n,n,'stable'))

Does the "set union" of the input string with itself, using the 'stable' method which does not sort, and then prints.

This works because union returns only non-duplicate values after the merge. So essentially if you union the string with itself, it first produces a string like Type unique chars!Type unique chars!, and then removes all duplicates without sorting.

No need for unique :)

#MATLAB, 29#

 @(n)disp(union(n,n,'stable'))

Does the "set union" of the input string with itself, using the 'stable' method which does not sort, and then prints.

This works because union returns only non-duplicate values after the merge. So essentially if you union the string with itself, it first produces a string like Type unique chars!Type unique chars!, and then removes all duplicates without sorting.

No need for unique :)

#MATLAB, 23#

 @(n)union(n,n,'stable')

Does the "set union" of the input string with itself, using the 'stable' method which does not sort, and then prints.

This works because union returns only non-duplicate values after the merge. So essentially if you union the string with itself, it first produces a string like Type unique chars!Type unique chars!, and then removes all duplicates without sorting.

No need for unique :)

added 289 characters in body
Source Link
Tom Carpenter
  • 4.3k
  • 13
  • 21

#MATLAB, 28#

@(s)disp(unique(s,'stable'))

Finds all the unique characters in the input string using the 'stable' method (which does not sort), and prints.

#MATLAB, 29#

 @(n)disp(union(n,n,'stable'))

Does the "set union" of the input string with itself, using the 'stable' method which does not sort, and then prints.

This works because union returns only non-duplicate values after the merge. So essentially if you union the string with itself, it first produces a string like Type unique chars!Type unique chars!, and then removes all duplicates without sorting.

No need for unique :)

#MATLAB, 28#

@(s)disp(unique(s,'stable'))

Finds all the unique characters in the input string using the 'stable' method (which does not sort), and prints.

#MATLAB, 29#

 @(n)disp(union(n,n,'stable'))

Does the "set union" of the input string with itself, using the 'stable' method which does not sort, and then prints.

This works because union returns only non-duplicate values after the merge. So essentially if you union the string with itself, it first produces a string like Type unique chars!Type unique chars!, and then removes all duplicates without sorting.

No need for unique :)

added 17 characters in body
Source Link
Tom Carpenter
  • 4.3k
  • 13
  • 21
Loading
Source Link
Tom Carpenter
  • 4.3k
  • 13
  • 21
Loading