Skip to content

Commit c109531

Browse files
Neverikjiegillet
authored andcommitted
Added bogo sort for smalltalk (#452)
* Added bogo sort for smalltalk * Fixed commit. * Fixed style
1 parent 5468ceb commit c109531

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

contents/bogo_sort/bogo_sort.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ In code, it looks something like this:
4747
[import:12-16, lang:"ruby"](code/ruby/bogo.rb)
4848
{% sample lang="f90" %}
4949
[import:24-32, lang:"fortran"](code/fortran/bogo.f90)
50+
{% sample lang="st" %}
51+
[import:2-6, lang:"st"](code/smalltalk/bogosort.st)
5052
{% endmethod %}
5153

5254
That's it.
5355
Ship it!
5456
We are done here!
5557

56-
## Example Code
58+
## Example Code
59+
5760
{% method %}
5861
{% sample lang="jl" %}
5962
[import, lang:"julia"](code/julia/bogo.jl)
@@ -92,6 +95,8 @@ We are done here!
9295
[import, lang:"ruby"](code/ruby/bogo.rb)
9396
{% sample lang="f90" %}
9497
[import, lang:"fortran"](code/fortran/bogo.f90)
98+
{% sample lang="st" %}
99+
[import, lang:"st"](code/smalltalk/bogosort.st)
95100
{% endmethod %}
96101

97102

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"Add this to the SequenceableCollection: "
2+
SequenceableCollection>>bogoSort
3+
"A simple bogosort."
4+
[ self isSorted ] whileFalse: [
5+
self shuffle.
6+
]
7+
8+
"Then you can run this anywhere: "
9+
#(4 3 2 1 6 5) bogoSort "#(1 2 3 4 5 6)"

0 commit comments

Comments
 (0)