summerschool_simtech_2023/cheatsheets/julia.qmd
2023-09-29 19:47:45 +00:00

28 lines
2.3 KiB
Plaintext

## List of Julia Cheetsheets
[Matlab-Julia-Python](https://cheatsheets.quantecon.org/)
[Julia Basic Commands (pdf)](https://images.datacamp.com/image/upload/v1667400319/Marketing/Blog/Julia_Cheat_Sheet.pdf)
## "meta"-tools
| | Julia | Python | R |
|--------------------|------------------|------------------|------------------|
| Documentation | `?obj` | `help(obj)` | `?obj` , `help(obj)` |
| Object content | `dump(obj)` | `print(repr(obj))` | `str(obj)` |
| Exported functions | `names(FooModule)` | `dir(foo_module)` | `ls("package:foo_module")` |
| List function signatures with that name | `methods(myFun)` | | `methods(myFun)` |
| List functions for specific type | `methodswith(SomeType)` | `dir(SomeType)` | `methods(SomeType)` |
| Where is ...? | `@which func` | `func.__module__` | |
| What is ...? | `typeof(obj)` | `type(obj)` | `class(obj)` |
| Is it really a ...? | `isa(obj, SomeType)` | `isinstance(obj, SomeType)` | `is(obj, SomeType)` |
## debugging {#debugging}
| | |
|------------------------------------|------------------------------------|
| `@run sum(5+1)` | run debugger, stop at error/breakpoints |
| `@enter sum(5+1)` | enter debugger, dont start code yet |
| `@show variable` | prints: variable = variablecontent |
| `@debug variable` | prints only to debugger, very convient in combination with `>ENV["JULIA_DEBUG"] = ToBeDebuggedModule` (could be `Main` as well) |