Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julia code somewhere on the landing page #115

Closed
StefanKarpinski opened this issue Aug 9, 2018 · 37 comments
Closed

Julia code somewhere on the landing page #115

StefanKarpinski opened this issue Aug 9, 2018 · 37 comments
Assignees

Comments

@StefanKarpinski
Copy link
Sponsor Member

StefanKarpinski commented Aug 9, 2018

I somehow didn't notice the fact that the otherwise-lovely homepage revamp has completely removed all Julia code from the landing page. We need to have some example of actual Julia code on that page. It would be good to brainstorm what a good bit of example code would be.

@ChrisRackauckas
Copy link
Member

Somehow the benchmark should be brought back, and I think showing them side by side but without making it busy would be best. Somehow.

@StefanKarpinski
Copy link
Sponsor Member Author

Pointed out on HN: https://news.ycombinator.com/item?id=17725174.

@wildart
Copy link
Member

wildart commented Aug 9, 2018

It looks like there is a plenty of space on the download/doc banner for Mandelbrot set program 😉

@ararslan
Copy link
Member

ararslan commented Aug 9, 2018

Yeah I rather liked our Mandelbrot code from the old site. Nice and concise code, familiar and understandable algorithm.

@joelandman
Copy link

I wrote a simple Riemann Zeta function calculator for a fixed value of the parameter.

https://github.com/joelandman/rzf/blob/master/julia/rzf.jl highlighting the expressiveness of language.

@improbable-22
Copy link

improbable-22 commented Aug 9, 2018

Note that this ζ(N,s) doesn't depend on s! But a similar function could showcase number types:

zeta(s, N=10^6) = real(s)>1 ? sum(1/n^s for n=1:N) : error() 

zeta(2, 10^8) ≈ π^2/6   # true 
zeta(complex(2,0))      # 1.644933 - 0.0im

using DualNumbers
zeta(dual(2,1))      # 1.644933 - 0.937533ɛ

But perhaps an expansion of a trig function, with complex values & derivatives people may recognise, would be better.

@ViralBShah
Copy link
Member

The benchmarks are linked. Maybe we can put the benchmarks and some code in one section. In fact, hovering on the benchmark could show that code, all of which are short snippets.

@StefanKarpinski
Copy link
Sponsor Member Author

I think linking through to the benchmarks is fine; not having any code examples on the first page is not.

@essenciary
Copy link

The markup for adding and showing code samples for each of the ecosystem tabs is there -- it's just a matter of adding it.

@cormullion
Copy link
Contributor

I was idly wondering how to show source code on the front page. I think it's possible but at the expense of making the site look a little denser and text-heavy. Remove the "Julia in a nutshell" text—it's kind of obvious from the size of the paragraphs—and use lead-in headings.

website-comp

Don't ask me how it would be done technically, I know little of this CSS wizardry...

@ufechner7
Copy link
Contributor

So what needs to be done to make this happen?

@StefanKarpinski
Copy link
Sponsor Member Author

Outsider or not, all you need to do to contribute is make a pull request and then have it reviewed! Help is greatly appreciated.

@flwalsh
Copy link

flwalsh commented Jun 28, 2019

I took a crack at this since no one else has, with the caveat that I'm in no way a web dev and the HTML/CSS may be imperfect. Before I clean things up and submit a pull request, I wanted to ask people's thoughts on some of the changes. Taking inspiration from nim's homepage, I put code on the right, slightly shrinking the jumbotron and the "Julia in a Nutshell" section, where I altered the various text boxes. In narrow windows, the code slides in beneath these.

Screen Shot 2019-06-27 at 2 49 19 PM

I tried to showcase a wide range of the language in limited space, which I didn't think the Mandelbrot function did well. If there are issues with code examples or descriptions here, it'd be possible to use the ones from cormullion's proposal instead.

@ViralBShah
Copy link
Member

Can we try a version with the jumbotron as it is right now and the code to the right of features? The features text can be further shortened if necessary.

@ararslan
Copy link
Member

First of all, thanks for trying this out!

which I didn't think the Mandelbrot function did well

I actually disagree here. I think the Mandelbrot function is a canonical, recognizable example and showcases Julia's clarity and brevity well. I think code on the homepage should give a brief taste of the language; I find the above a bit overwhelming.

@ViralBShah
Copy link
Member

One thing the Mandelbrot doesn't show off is user-defined types. Perhaps something similar in spirit to Mandelbrot but using Arrays of RGB values using Images.jl might be a bit better.

One other possibility for showing off code could be a screencast or slideshow that shows the code, and then running time, and the C or Python versions. Just putting some ideas out there.

@ararslan
Copy link
Member

As a couple of data points:

  • Rust no longer has code on their homepage
  • Ruby's is printing "hello world"
  • Python's is Fibonacci
  • Haskell has prime sieve
  • Clojure has nothing
  • Scala has a weird "hello world"
  • Swift has nothing

@StefanKarpinski
Copy link
Sponsor Member Author

If there was "see some code examples" link to a page with code examples, that might also be fine.

@flwalsh
Copy link

flwalsh commented Jul 4, 2019

Thanks for the feedback everyone. Here's take 2 (though I need to fix code block alignment):

Screen Shot 2019-07-03 at 8 47 13 PM

which I didn't think the Mandelbrot function did well

I actually disagree here.

What I meant is that this function shows only basic control structure and little unique to Julia (compared to say MATLAB) in 11 lines, which is most of the available space. However, I agree it's a pretty introduction and a

"see some code examples" link

(as in the screenshot) could compliment it nicely. I know I would've found an example page useful when learning about Julia.

If people think this is reasonable I'll give it a shot. Things I'd include (very briefly, maybe 5-10 lines each just to highlight all the syntax/features that make Julia so great, like an extended version of my previous attempt):

  • control structure
  • type system
  • math and multi-dimensional arrays
  • strings
  • macros
  • I/O
  • low level manipulation

Other replies:

version with the jumbotron as it is right now

I don't mind leaving the Jumbotron full-width, but would it be OK to shrink it a little vertically? It takes up an enormous amount of screen real estate as is, especially with the header and banner.

As a couple of data points:

  • Rust no longer has code on their homepage

If I were making a page for Rust, I wouldn't show code either ;)

@ararslan
Copy link
Member

ararslan commented Jul 4, 2019

What you've shown there looks awesome to me! I would 100% support a PR for that. Nice work!

If I were making a page for Rust, I wouldn't show code either ;)

😂

@ViralBShah
Copy link
Member

I like the idea - but not so much design-wise. Can we do a separate page with Code examples as Stefan suggested, and show off several language features? Kind of along the lines of the first trial above?

@ViralBShah
Copy link
Member

While not the same as having code on the landing page, I've added a link to browsing the microbenchmarks in the "Easy to Use" section right on top as a quick way to see the code.

@logankilpatrick
Copy link
Sponsor Member

Hey all, let me know your thoughts on this.

@goggle
Copy link
Contributor

goggle commented Jan 25, 2020

Why don't we just add the code examples in an additional section on the homepage?
It could be something like the currently existing section "Ecosystem", where the user could click through different code examples in a horizontal menu.

@logankilpatrick
Copy link
Sponsor Member

Yeah, that’s a possible solution.

@ViralBShah
Copy link
Member

The microbenchmarks would be perfect to link to for code examples.

@StefanKarpinski
Copy link
Sponsor Member Author

I don't think the microbenchmarks are ideal code examples, although they're not the worst. They're certainly better than nothing, which has been the status quo since I opened this issue.

@logankilpatrick
Copy link
Sponsor Member

We can link the microbenchmarks and also some coding examples. Is there somewhere I can look for good examples of Julia code?

@ViralBShah
Copy link
Member

I think some things in stdlib could be interesting, but one has to pick carefully. Also, perhaps from some of the common packages.

@cormullion
Copy link
Contributor

@logankilpatrick The trick with good examples is to make sure you only introduce one new thing (here, the Julia syntax), so it's not a good idea to show How to Integrate a Tschaikovsky Manifold Gradient, or whatever. ;)

A good source of basic and familiar examples is Rosetta Code - be warned that some of them were written for early versions of Julia, and the syntax would need updating (and possibly vetted for style, depending on who originally wrote them).

@StefanKarpinski
Copy link
Sponsor Member Author

I would say just pick some examples and get this merged and then we can iterate on the examples once it's clear where to put them.

@logankilpatrick
Copy link
Sponsor Member

Examples from the link above?

@ararslan
Copy link
Member

I vote for #115 (comment) or #115 (comment) as a first pass.

@KristofferC
Copy link
Sponsor Member

The pisumvec looks really unideomatic.

@KristofferC
Copy link
Sponsor Member

KristofferC commented Jan 28, 2020

I like the mandelbrot one. There is a space missing after the comma. I also think we should show calling the function (to show the nice complex syntax, i.e. add mandel(0.5 + im) or whatever is a good point.

What I meant is that this function shows only basic control structure and little unique to Julia (compared to say MATLAB) in 11 lines, which is most of the available space.

I think this is fine. We just have to get across that we don't look like Haskell or something and if people feel a bit familiar I don't think that is bad.

@logankilpatrick
Copy link
Sponsor Member

Okay, I will move that example into the example page and request a final review.

@logankilpatrick logankilpatrick self-assigned this Jan 28, 2020
@logankilpatrick
Copy link
Sponsor Member

I just merged this. I'm sure that what I did was not perfect but I wanted to get the ball rolling so we can iterate. Feel free to open a new issue or PR if you think the example needs something or I missed the mark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests