[racket] In rkt or scheme, is there way to refer to the value of last expression?

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Mon Dec 12 19:02:47 EST 2011

J G Cho wrote at 12/12/2011 06:49 PM:
> Just for the readability, is it possible to write
>
> some-list
> (proc-1 some-list)
> (proc-2 (val-of-last-expression))
> ...
> (proc-n (val-of-last-expression)) ;where n is 'largeish'
>    


If you are interacting in XRepl, you can do this:
http://docs.racket-lang.org/xrepl/index.html?q=xrepl#%28part._past-vals%29

You can also define a new "#lang" or syntactic form that does this.  
Whether using this would be more "readable" than nesting the expressions 
the usual way, I could not say.

It might also be the case that these is a better way do solve your 
particular concrete problem, rather than either "largeish N" nested 
procedure applications or breaking the usual syntactic clarity of Racket.

-- 
http://www.neilvandyke.org/


Posted on the users mailing list.