User:Kernigh: Difference between revisions

From Rosetta Code
Content added Content deleted
(Add Emacs Lisp to the (already too long) list of languages.)
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{mylangbegin}}
{{mylangbegin}}
|- style="background: white;"
| colspan="2" |'''4''' is best, '''1''' is worst.
{{mylang|Ruby|4}}
{{mylang|Ruby|4}}
{{mylang|C|3}}
{{mylang|C|3}}
{{mylang|Java|3}}
{{mylang|Factor|3}}
{{mylang|Perl|3}}
{{mylang|WML|3}}
{{mylang|C++|2}}
{{mylang|CMake|2}}
{{mylang|Common Lisp|2}}
{{mylang|Java|2}}
{{mylang|Perl|2}}
{{mylang|Emacs Lisp|1}}
{{mylang|PicoLisp|1}}
{{mylang|Python|1}}
|- style="background: #df0;"
| colspan="2" |↓ ''Unix Classic Tools'' ↓
{{mylang|UNIX Shell|3}}
{{mylang|UNIX Shell|3}}
{{mylang|AWK|2}}
{{mylang|AWK|2}}
{{mylang|bc|2}}
{{mylang|bc|2}}
{{mylang|CMake|2}}
{{mylang|Common Lisp|2}}
{{mylang|dc|2}}
{{mylang|dc|2}}
{{mylang|make|2}}
{{mylang|make|2}}
{{mylang|WML|2}}
{{mylang|C Shell|1}}
{{mylang|Factor|1!}}
{{mylang|m4|1}}
{{mylang|m4|1}}
{{mylang|PicoLisp|1!}}
{{mylang|Python|1}}
{{mylang|Scala|1!}}
{{mylang|sed|1}}
{{mylang|sed|1}}
|- style="background: #df0;"
| colspan="2" |↓ ''Alternate Shells'' ↓
{{mylang|C Shell|2}}
{{mylang|es|1}}
|- style="background: #df0;"
| colspan="2" |↓ ''Not BSD'' ↓
{{mylang|AutoHotkey|1}}
{{mylang|TI-83 BASIC|1}}
{{mylangend}}
{{mylangend}}
Language proficiency:
* '''4''' I prefer this language.
* '''3''' I know much about this language. I can solve many tasks.
* '''2''' I know part of this language. I can solve some tasks.
* '''1''' I can only use this language for a few simple tasks.
* '''!''' I never used this language until I saw it at Rosetta Code.


Ruby is my best language. Most of my contributions come from an [[OpenBSD]] machine. A few of my examples come from a [[Windows]] machine with [[MinGW]]. I never used Factor, PicoLisp nor AutoHotkey until I found them at Rosetta Code.
== Contributions by Kernigh ==
* New task: [[Subtractive generator]]


* [https://github.com/kernigh/factor Factor for OpenBSD/amd64]
== In progress ==
* [http://code.google.com/r/kernigh-picolisp/ PicoLisp for OpenBSD/amd64]
<lang c>#include <stdio.h>
#include <stdlib.h>


== Contributions by Kernigh ==
#if defined(_WIN32)
* First 20 examples for [[:Category:CMake]] and [[:Category:C Shell]]
#include <windows.h>
* New tasks
#include <process.h>
** Message digests: ''[[MD4]] (DRAFT)'', ''[[RIPEMD-160]] (DRAFT)'', [[SHA-1]]

** Matrices: ''[[Conjugate transpose]] (DRAFT)'', ''[[Identity matrix]] (DRAFT)''
/* ARGSUSED */
** Other new tasks: [[Caesar cipher]], [[Deal cards for FreeCell]], [[Empty directory]], [[Even or odd]], [[Least common multiple]], [[Linear congruential generator]], [[Return multiple values]], [[Set]], [[Subtractive generator]]
unsigned __stdcall
run2(void *arg)
{
printf(" %d\n", rand());
printf(" %d\n", rand());
printf(" %d\n", rand());
return 0;
}

void
run(void)
{
HANDLE thread;
thread = (HANDLE)_beginthreadex(NULL, 0, run2, NULL, 0, NULL);
if (thread) {
WaitForSingleObject(thread, INFINITE);
CloseHandle(thread);
} else
puts("Error!");
}
#elif defined(__unix__)
#include <pthread.h>

/* ARGSUSED */
void *
run2(void *arg)
{
printf(" %d\n", rand());
printf(" %d\n", rand());
printf(" %d\n", rand());
return NULL;
}

void
run(void)
{
pthread_t thread;
if (pthread_create(&thread, NULL, run2, NULL) ||
pthread_join(thread, NULL))
puts("Error!");
}
#else
#error Port run() to your system.
#endif

int
main()
{
srand(42);
puts("Thread A:");
run();
puts("Thread B:");
run();
return 0;
}</lang>


== Ruby methods in Enumerable ==
<pre>Thread A:
{| class="wikitable"
41
!| Method
18467
!| Rosetta Code task
6334
|-
Thread B:
|| <code>#all?</code>
41
|-
18467
|| <code>#any?</code>
6334</pre>
|-
|| <code>#chunk</code>
|-
|| <code>#collect</code>
|-
|| <code>#collect_concat</code>
|-
|| <code>#count</code>
|-
|| <code>#cycle</code>
|-
|| <code>#detect</code>
|-
|| <code>#drop</code>
|-
|| <code>#drop_while</code>
|-
|| <code>#each_cons</code>
|-
|| <code>#each_entry</code>
|-
|| <code>#each_slice</code>
|-
|| <code>#each_with_index</code>
|-
|| <code>#each_with_object</code>
|-
|| <code>#entries</code>
|-
|| <code>#find</code>
|-
|| <code>#find_all</code>
|-
|| <code>#find_index</code>
|-
|| <code>#first</code>
|-
|| <code>#flat_map</code>
|-
|| <code>#grep</code>
|-
|| <code>#group_by</code>
|-
|| <code>#include?</code>
|-
|| <code>#inject</code>
|-
|| <code>#map</code>
|-
|| <code>#max</code>
|-
|| <code>#max_by</code>
|-
|| <code>#member?</code>
|-
|| <code>#min</code>
|-
|| <code>#min_by</code>
|-
|| <code>#minmax</code>
|-
|| <code>#minmax_by</code>
|-
|| <code>#none?</code>
|-
|| <code>#one?</code>
|-
|| <code>#partition</code>
|-
|| <code>#reduce</code>
|-
|| <code>#reject</code>
|-
|| <code>#reverse_each</code>
|-
|| <code>#select</code> || [[Filter]]
|-
|| <code>#slice_before</code>
|-
|| <code>#sort</code> ||
* [[Sort an integer array]]
* [[Sort using a custom comparator]]
|-
|| <code>#sort_by</code> || [[Sort an array of composite structures]]
|-
|| <code>#take</code>
|-
|| <code>#take_while</code>
|-
|| <code>#to_a</code>
|-
|| <code>#zip</code> || [[Loop over multiple arrays simultaneously]]
|}

Latest revision as of 19:14, 25 July 2012

My Favorite Languages
Language Proficiency
4 is best, 1 is worst.
Ruby 4
C 3
Factor 3
WML 3
C++ 2
CMake 2
Common Lisp 2
Java 2
Perl 2
Emacs Lisp 1
PicoLisp 1
Python 1
Unix Classic Tools
UNIX Shell 3
AWK 2
bc 2
dc 2
make 2
m4 1
sed 1
Alternate Shells
C Shell 2
es 1
Not BSD
AutoHotkey 1
TI-83 BASIC 1

Ruby is my best language. Most of my contributions come from an OpenBSD machine. A few of my examples come from a Windows machine with MinGW. I never used Factor, PicoLisp nor AutoHotkey until I found them at Rosetta Code.

Contributions by Kernigh

Ruby methods in Enumerable

Method Rosetta Code task
#all?
#any?
#chunk
#collect
#collect_concat
#count
#cycle
#detect
#drop
#drop_while
#each_cons
#each_entry
#each_slice
#each_with_index
#each_with_object
#entries
#find
#find_all
#find_index
#first
#flat_map
#grep
#group_by
#include?
#inject
#map
#max
#max_by
#member?
#min
#min_by
#minmax
#minmax_by
#none?
#one?
#partition
#reduce
#reject
#reverse_each
#select Filter
#slice_before
#sort
#sort_by Sort an array of composite structures
#take
#take_while
#to_a
#zip Loop over multiple arrays simultaneously