Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference last value returned by Clojure REPL

I'm at the Clojure REPL and I enter a value

user=> [:a :b :c]
[:a :b :c]

How can I refer to that value in a later expression?

like image 590
Brett Rowberry Avatar asked May 09 '26 02:05

Brett Rowberry


1 Answers

  • *1 for the last result
  • *2 for the one before *1
  • and finally *3 (can't go back further)

For example:

user=> [:a :b :c]
[:a :b :c]
user=> (count *1)
3

See https://clojure.org/guides/repl/data_visualization_at_the_repl#_accessing_recent_results_1_2_3

like image 131
Brett Rowberry Avatar answered May 10 '26 23:05

Brett Rowberry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!