[UPDATE AS OF 4/15/19]: 📕Language Learning Club 🤓
Update
I have books/resources, and they're free!
SCHEDULING
We will be working on 1 concept a week, starting today. Next Monday, I'll check in with everyone--if that's too fast or too slow, we can always change it. But that will be the pace to start.
VOICE CHATS
Discord voice chats will begin next week (4/22/19) and decided on based on the results of the following polls:
JAVA poll link: https://doodle.com/poll/kzukrpm3z8dd44m3
GO poll link: https://doodle.com/poll/piq93mhaipxz8wx9
And without further adieu... your books:
JAVA LEARNERS: http://greenteapress.com/thinkjava6/thinkjava.pdf
GO LEARNERS: https://gobyexample.com
I encourage everyone to download/save this information somewhere just in case!
Hey everyone!
Following up on @amasad's post here.
We're building out some learning materials over on our Discord server, and we would love your input!
We've now added a few Language Learning Club channels, with the idea being we'd all learn together.
Before we choose our very first language, I'd love to see what you all are interested in learning.
If you could fill out this survey by Weds at 5:00 PM CST, that'd be great.
Feel free to post any questions/concerns below.
P.S. YES, we will have voice chat for this! 🗣
Here is a list of factorial examples in several different languages so you can so what different languages look like.
Tcl:
proc fact {n} {
if {$n == 1} {
return 0
} else {
return [expr $n * [fact [expr $n - 1]]]
}
}
puts [fact 5]
#=> 120
Red:
Red []
fact: func[n] [
either n = 0 [
return 1
] [
return n * fact n - 1
]
]
print fact 5 ;=> 120
Scala:
object Main extends App {
def fact(n: Int): Int = {
if(n == 0) {
return 1
} else {
return n * fact(n - 1)
}
}
def main(args: Array[String]) = {
println(fact(5)) //=> 120
}
}
Pascal:
program ex;
function fact(n: integer): integer;
begin
if n = 0 then
result := 1;
else
result := n * fact(n - 1);
end;
begin
writeln(fact(5)); {=> 120}
end.
Swift:
func fact(number n: Int) -> Int {
if n == 0 {
return 1
} else {
return n * fact(number: n - 1)
}
}
print(fact(number: 5)) //=> 120
Ruby:
def fact n
if n == 0
1
else
n * (fact n - 1)
end
end
puts fact 5 #=> 120
Perl 6:
multi sub fact(0) {1}
multi sub fact(Int $n where * ≥ 1) {$n * fact $n - 1}
say fact 5 #=> 120
Julia:
function fact(n::Int)::Int
if n == 0
return 1
else
return n * fact(n - 1)
end
end
println(fact(5)) #=> 120
C#:
using System;
class MainClass {
public static int fact(int n) {
if(n == 0)
return 1;
else
return n * fact(n - 1);
}
public static void Main(string[] args) {
Console.WriteLine(fact(5)); //=> 120
}
}
CoffeeScript:
fact = (n) ->
if n is 0
1
else
n * fact n - 1
console.log fact 5 #=> 120
Haxe:
class Fact {
static function fact(n: Int) {
if(n == 0)
return 1;
else
return n * fact(n - 1);
}
static function main() {
trace(fact(5)); //=> 120
}
}
R:
fact <- function(n) {
if(n == 0) {
return(1)
} else {
return(n * fact(n - 1))
}
}
print(fact(5))
As you can see, there are a lot of cool languages out there, so hopefully you'll come learn some of these with us!
(pls upvote this took me like half an hour)
This is great, @theangryepicbanana -- I think something along the same lines for printing "Hello World" and simple loops would also be great.
@themaka ye I'll do that soon
Bonus: Here's some more languages: -
JavaScript: -
function fact(num) {
if(num === 0)
return 1;
else
return num * fact(num - 1);
}
console.log(fact(5); //=> 120
Java: -
class Main {
static int fact(int n) {
if(n == 0) {
return 1;
}
else {
return n * fact(n-1);
}
}
public static void main(String[] args) {
System.out.println(fact(5)); //=> 120
}
}
C
#include <stdio.h>
int fact(int n) {
if(n == 0) {
return 1;
}
else {
return n * fact(n-1);
}
}
int main(void) {
printf("%d",fact(5)); //=> 120
return 0;
}
C++
#include <iostream>
int fact(int n) {
if(n == 0) {
return 1;
}
else {
return n * fact(n-1);
}
}
int main() {
std::cout << fact(5); //=> 120
}
Kotlin
fun fact(num: Int): Int {
if(num == 0) {
return 1
}
else {
return num * fact(num - 1)
}
}
println(fact(5)) //=> 120
Python
def fact(n):
if n == 0:
return 1
else:
return n * fact(n-1)
print(fact(5)) #=>120
Rust
fn fact(n: u128) -> u128 {
if n == 0 {
return 1;
}
else {
return n * fact(n-1);
}
}
fn main() {
println!("{}", fact(5)); //=> 120
}
@TheDrone7 I had been doing lesser-known languages
@theangryepicbanana I observed as much, although I don't think Ruby, Swift and C# are lesser-known languages, specially C#.
@TheDrone7 Wow, thanks guys! This is great.
Here is another extra: factorial examples using even more languages!
In PHP:
In forth:
In LISP:
The same thing in BrainF (yeah, that is complicated...)
In F#:
Now in Ocaml
I hope you enjoyed these extra languages which might be interesting. [Warning: Upvote begging ahead!] Upvote this damn it, i spent an hour using brainf.
@enigma512 I already did Pascal, and try adding highlighting
@theangryepicbanana Pascal removed. Syntax highlighting not added yet
@enigma_dev We all love brainf