What I understand, you want to define function directly in shell and play with it. Then wrap functionality you want to test with fun/anonymous function, example:
13> ShellFunction = fun(X) -> io:format("Some logic in my function"), 2*2 end.
#Fun<erl_eval.6.80484245>
14> ShellFunction(4).
Some logic in my function4
It is only good for small pieces of code you want to test in shell.