Hacker News new | ask | show | jobs
by markkitti 907 days ago
How about a 16K Hello World?

  julia> using StaticTools, StaticCompiler
  
  julia> hello_world() = printf(c"Hello World\n")
  hello_world (generic function with 1 method)
  
  julia> compile_executable(hello_world, (), "./")
  "~/hello_world"
  
  shell> ./hello_world
  Hello World
  
  shell> du -h hello_world
  16K hello_world
See https://github.com/brenhinkeller/StaticTools.jl for further details and limitations.

For discovering methods you can do

  julia> ?("hello", 1, 2.0)[TAB]
  broadcast(f, x::Number...) @ Base.Broadcast broadcast.jl:844
  readuntil(filename::AbstractString, args...; kw...) @ Base io.jl:520
  ...
See the Tab Completion section of the REPL documentation, https://docs.julialang.org/en/v1/stdlib/REPL/#Tab-completion .