User:Kernigh: Difference between revisions

Add Emacs Lisp to the (already too long) list of languages.
(Add least common multiple. Add TI-83 BASIC.)
(Add Emacs Lisp to the (already too long) list of languages.)
 
(13 intermediate revisions by the same user not shown)
Line 1:
{{mylangbegin}}
|- style="background: white;"
| colspan="2" |'''4''' is best, '''1''' is worst.
{{mylang|Ruby|4}}
{{mylang|C|3}}
{{mylang|Factor|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|AWK|2}}
{{mylang|bc|2}}
{{mylang|CMake|2}}
{{mylang|Common Lisp|2}}
{{mylang|C Shell|2}}
{{mylang|dc|2}}
{{mylang|Factor|2*}}
{{mylang|Java|2}}
{{mylang|make|2}}
{{mylang|Perl|2}}
{{mylang|WML|2}}
{{mylang|m4|1}}
{{mylang|PicoLisp|1*}}
{{mylang|Python|1}}
{{mylang|Scala|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}}
 
Language proficiency:
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.
* '''4''' I prefer this language.
 
* '''3''' I know much about this language. I can solve many tasks.
* [https://github.com/kernigh/factor Factor for OpenBSD/amd64]
* '''2''' I know part of this language. I can solve some tasks.
* [http://code.google.com/r/kernigh-picolisp/ PicoLisp for OpenBSD/amd64]
* '''1''' I can only use this language for a few simple tasks.
* '''*''' I never used this language until I saw it at Rosetta Code.
 
== Contributions by Kernigh ==
* First 20 examples for [[:Category:CMake]] and [[:Category:C Shell]]
* New tasks
** Message digests: ''[[MD4]] (DRAFT)'', ''[[RIPEMD-160]] (DRAFT)'', [[SHA-1]]
** [[Caesar cipher]]
** Matrices: ''[[Conjugate transpose]] (DRAFT)'', ''[[Identity matrix]] (DRAFT)''
** [[Least common multiple]]
** 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]]
** [[Linear congruential generator]]
** [[Set]]
** [[Subtractive generator]]
 
== In progress ==
<lang c>#include <stdio.h>
#include <stdlib.h>
 
#if defined(_WIN32)
#include <windows.h>
#include <process.h>
 
/* ARGSUSED */
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]]
|}
Anonymous user