Skip to content

Instantly share code, notes, and snippets.

@cgrand
Last active March 6, 2021 17:16
Show Gist options
  • Save cgrand/cfd0f679fdd4c89c92fa1e02cbfbee96 to your computer and use it in GitHub Desktop.
Save cgrand/cfd0f679fdd4c89c92fa1e02cbfbee96 to your computer and use it in GitHub Desktop.

Revisions

  1. 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 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 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!
    """