Skip to main content
Commonmark migration
Source Link

2012 - Julia

###Language History

Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while Jeff was a student at the Massachussets Institute of Technology (MIT), advised by professor Alan Edelman. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

###"Hello, World!" Variant

"Hello, World!" Variant

println("Julia was made in 2012!")

Printing to STDOUT in Julia is quite simple!

###ASCII Art N

ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

###GCD

GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

2012 - Julia

###Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while Jeff was a student at the Massachussets Institute of Technology (MIT), advised by professor Alan Edelman. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

###"Hello, World!" Variant

println("Julia was made in 2012!")

Printing to STDOUT in Julia is quite simple!

###ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

###GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

2012 - Julia

Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while Jeff was a student at the Massachussets Institute of Technology (MIT), advised by professor Alan Edelman. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

"Hello, World!" Variant

println("Julia was made in 2012!")

Printing to STDOUT in Julia is quite simple!

ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

Viral and Stefan were not MIT students. Also updated syntax highlighting and capitalized "STDOUT."
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119

2012 - Julia

###Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while they were studentsJeff was a student at the Massachussets Institute of Technology (MIT), as well asadvised by professor Alan Edelman, a professor at MIT. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

###"Hello, World!" Variant

println("Julia was made in 2012!")
println("Julia was made in 2012!")

Printing to stdoutSTDOUT in Julia is quite simple!

###ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end
function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

###GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end
function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

2012 - Julia

###Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while they were students at the Massachussets Institute of Technology (MIT), as well as Alan Edelman, a professor at MIT. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

###"Hello, World!" Variant

println("Julia was made in 2012!")

Printing to stdout in Julia is quite simple!

###ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

###GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

2012 - Julia

###Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while Jeff was a student at the Massachussets Institute of Technology (MIT), advised by professor Alan Edelman. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

###"Hello, World!" Variant

println("Julia was made in 2012!")

Printing to STDOUT in Julia is quite simple!

###ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

###GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

added 4 characters in body
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119

2012 - Julia

###Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while they were students at the Massachussets Institute of Technology (MIT), as well as Alan Edelman, a professor at MIT. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

###"Hello, World!" Variant

println("Julia was made in 2012!")
println("Julia was made in 2012!")

Printing to stdout in Julia is quite simple!

###ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end
function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

###GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end
function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

2012 - Julia

###Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while they were students at the Massachussets Institute of Technology (MIT), as well as Alan Edelman, a professor at MIT. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

###"Hello, World!" Variant

println("Julia was made in 2012!")

Printing to stdout in Julia is quite simple!

###ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

###GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

2012 - Julia

###Language History

Julia was developed in 2012 by Jeff Bezanson, Stefan Karpinski, and Viral Shah while they were students at the Massachussets Institute of Technology (MIT), as well as Alan Edelman, a professor at MIT. They were motivated by a desire for a programming language that was open source, fast, and dynamic (among many other things) while maintaining ease of use in a variety of applications. The product was Julia, a fresh approach to high performance scientific computing.

###"Hello, World!" Variant

println("Julia was made in 2012!")

Printing to stdout in Julia is quite simple!

###ASCII Art N

function asciin(n)
    # Create an nxn matrix of spaces
    m = fill(" ", (n, n))

    # Fill the first and last columns with "N"
    m[:,1] = m[:,n] = "N"

    # Fill the diagonal elements with "N"
    setindex!(m, "N", diagind(m))

    # Print each row of the matrix as a joined string
    for i = 1:n
        println(join(m[i,:]))
    end
end

The code is indented for readability, but Julia imposes no restrictions on whitespace.

###GCD

function g(a, b)
    b == 0 ? a : g(b, a % b)
end

The last thing listed in the function is implicitly returned.

Use matrix approach for ASCII N. Cooler. :)
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119
Loading
Use recursion for the GCD
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119
Loading
Forgot that "string"^0 was legit
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119
Loading
Renamed task sections
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119
Loading
Linked to Julia
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119
Loading
Task 0. Fixed task 2. Explanations.
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119
Loading
Task 0. Fixed task 2.
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119
Loading
Source Link
Alex A.
  • 24.7k
  • 5
  • 38
  • 119
Loading