# Atom snippets for linspace etc

**URL:** https://discourse.julialang.org/t/atom-snippets-for-linspace-etc/16156
**Category:** General Usage
**Tags:** juno
**Created:** [October 11, 2018, 6:33am UTC](https://discourse.julialang.org/t/atom-snippets-for-linspace-etc/16156 "2018-10-11T06:33:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [October 11, 2018, 6:33am UTC](https://discourse.julialang.org/t/atom-snippets-for-linspace-etc/16156/1 "2018-10-11T06:33:06Z")

</div>

I find it tedious to use the new range constructor, especially to construct logarithmically spaced ranges.  
`exp10.(range(-1, stop=1, length=10))`  
I therefore created atom snippets to write them out for me. Now I only have to start typing `linspace` or `logspace` as before and insert the snippet with a press on . I thought my snippets below might be of use for others as well. To use them, place the code below in your snippets.cson (Ctrl-shift-P to open command palette and search for “open your snippets” to open snippets.cson).

```julia
'.source.julia':

  'pkgdir':
    'prefix': 'pkgdir'
    'body': 'joinpath(dirname(pathof($1)), "$2")$3'

  'logspace':
    'prefix': 'logspace'
    'body': 'exp10.(range($1, stop=$2, length=$3))$4'

  'linspace':
    'prefix': 'linspace'
    'body': 'range($1, stop=$2, length=$3)$4'

  'eye':
    'prefix': 'eye'
    'body': 'Matrix{Float64}(I, $1, $1)$2'

  'TODO':
    'prefix': 'todo'
    'body': '# TODO: $1'

  'iter':
    'prefix': 'iter'
    'body': 'function Base.iterate($1::$2, state=$3)\nstate == length($4) && return nothing\n ($5,state+1)\nend\nBase.length($1::$2)\n'

  'esc':
    'prefix': 'esc'
    'body': '\$(esc($1))$2'

```
