(or use `workspace()`)

On Mon, May 18, 2015 at 11:56 AM, Jameson Nash <vtjn...@gmail.com> wrote:

> at some point you probably entered something like:
> sum = 5
>
> from that point on, sum refers to 5, rather than the Base.sum function.
>
> you could restore it by typing
> sum = Base.sum
>
> or just restart
>
>
> On Mon, May 18, 2015 at 11:37 AM James Byars <jimmyby...@gmail.com> wrote:
>
>> Thank you. I said this in the post below, but is this an issue with Julia
>> going forward? The need to restart.
>>
>>
>> On Monday, May 18, 2015 at 10:50:28 AM UTC-4, Kristoffer Carlsson wrote:
>>
>>> This works for me, both in Julia 0.3 and 0.4
>>>
>>> julia> function fib_sum_2(x,y,z)
>>>            sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)
>>>        end
>>> fib_sum_2 (generic function with 1 method)
>>>
>>>
>>> julia> fib_sum_2(3,5,999)
>>> 233168
>>>
>>> What happens if you restart Julia and try again?
>>>
>>>
>>>
>>>
>>>
>>> On Monday, May 18, 2015 at 4:34:11 PM UTC+2, James Byars wrote:
>>>>
>>>> Hello all,
>>>>
>>>> I am an education doctoral student who is a self-taught stats and
>>>> programming person. My primary coding and stats experience is with R. I
>>>> have started to attempt Julia and was using the Project Euler questions as
>>>> a way to teach myself the language structure, types, and specifying
>>>> functions. I have been really drawn to Julia because of all the great
>>>> conversations about the language on the YouTube channel. There have been
>>>> several great repositories that share coding examples for each of the
>>>> problems (although Project Euler wants everybody to do it on their own)
>>>> which have been tremendously helpful.
>>>>
>>>> One of the proposed solutions for Problem #1 have this structure:
>>>> println(sum(3:3:999) + sum(5:5:999) - sum(15:15:999))
>>>>
>>>> I am trying to make a function of this type of problem so I am not
>>>> bounded by specifying each number every time. So I adapted the solution to
>>>> the following format:
>>>>
>>>> *function fib_sum_2(x,y,z)*
>>>> *    sum(x:x:z) + sum(y:y:z) - sum(lcm(x,y):lcm(x,y):z)*
>>>> *end*
>>>>
>>>> However, when I try to run the function (fib_sum_2(3,5,999)) I get the
>>>> following error:
>>>>
>>>> *type: fib_sum_2: in apply, expected Function, got Int64
>>>> while loading In[140], in expression starting on line 1
>>>>
>>>>  in fib_sum_2 at In[137]:2*
>>>>
>>>>
>>>> I did attempt to google this problem, but still could not find a source 
>>>> that really explained the problem. I understand that this is a really 
>>>> newbie question and thank you to everyone for their patience and any 
>>>> assistance. If anybody can correct my error or provide resources that 
>>>> might help me with future Euler Project problems that would be great. I 
>>>> feel that I am missing something terribly easy with Julia, but thank you 
>>>> all for any help. Also, I am using IJulia for reference. If I have posted 
>>>> this question in error, can anybody direct me to the right forum?
>>>>
>>>>
>>>> With Regards,
>>>>
>>>>
>>>> James
>>>>
>>>>

Reply via email to