Here is a curated list of various Julia tips and tricks to use with Julia's REPL interface. The nice colors (and some of the tricks) use OhMyREPL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is just an elaboration of an off-hand toot I made earlier today | |
| // concerning a coding pattern I find myself doing whenever possible: passing | |
| // and returning owned values instead of borrowing references. | |
| // | |
| // I find it works well for long-lived values especially since the resulting | |
| // composite objects have no lifetime qualifiers, so I don't have to plumb | |
| // lifetimes through to all the code that uses them. | |
| // Assumption: assume we have a few objects like this: a network connection, a | |
| // database, some commands, etc. and we want to make a session type that uses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Base.Threads: @spawn, nthreads, threadid | |
| N = 100 | |
| chan = Channel(nthreads()) do chan | |
| for val in 1:N | |
| put!(chan, val) | |
| println("T$(threadid()) => put $(val)") | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROGRAM := llvm-brainfuck | |
| OBJECTS := main.o | |
| SHIM := shim.a | |
| SHIM_OBJECTS := shim.o | |
| CC := clang | |
| CXX := clang++ | |
| CXXFLAGS := $(shell llvm-config --cppflags) -Wall -Werror -pedantic | |
| LDFLAGS := $(shell llvm-config --ldflags --libs core) |

