On Fri, Jul 3, 2015 at 8:21 PM, Kevin Owens <kevin.j.ow...@gmail.com> wrote:
> Gah, nevermind:
>
> function as_symbol(x)
>     :(print(x)).args[2]
> end

This is almost certainly not what you want unless you just want a
function that returns `:x`, in which case, you would be better off to
just return that.

Can you elaborate on what exactly you would like to do? Depending on
what you really want, there are different ways to implement.

>
>
> (using print() so that it works regardless of the type)
>
>
> On Friday, July 3, 2015 at 7:16:38 PM UTC-5, Kevin Owens wrote:
>>
>> Say you have an array
>>
>> x = rand(5)
>>
>> or just any variable
>>
>> y = "abc"
>>
>> How would I write a function that I would call like foo(x) and would
>> return the symbol :x?

Reply via email to