Skip to content

Instantly share code, notes, and snippets.

@fmnoise
Forked from cgrand/heredoc.clj
Created January 26, 2019 16:13
Show Gist options
  • Save fmnoise/16fbbb6b5675c5195c0da1fd47e3d97f to your computer and use it in GitHub Desktop.
Save fmnoise/16fbbb6b5675c5195c0da1fd47e3d97f to your computer and use it in GitHub Desktop.

Revisions

  1. @cgrand cgrand revised this gist Jan 8, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion heredoc.clj
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    (interpose \newline)
    (apply str))))

    ; The following lines evaluate to:
    ; The following lines are read (by the reader) as:
    ; "Look )(\"\\T\na here doc!\n"
    #=(heredoc)"""
    Look )("\T
  2. @cgrand cgrand revised this gist Jan 7, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion heredoc.clj
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    (interpose \newline)
    (apply str))))

    ; The following linkes evaluates to:
    ; The following lines evaluate to:
    ; "Look )(\"\\T\na here doc!\n"
    #=(heredoc)"""
    Look )("\T
  3. @cgrand cgrand created this gist Jan 7, 2019.
    13 changes: 13 additions & 0 deletions heredoc.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    (defn heredoc []
    (let [delim (.readLine *in*)]
    (->> (repeatedly #(.readLine *in*))
    (take-while #(not= delim %))
    (interpose \newline)
    (apply str))))

    ; The following linkes evaluates to:
    ; "Look )(\"\\T\na here doc!\n"
    #=(heredoc)"""
    Look )("\T
    a here doc!
    """