[Haskell-cafe] Why cannot i add the `let` declaration ?
zaxis
z_axis at 163.com
Sat Jan 30 04:13:57 EST 2010
thanks!
Ivan Lazar Miljenovic wrote:
>
> zaxis <z_axis at 163.com> writes:
>> find_the_day sDay 0 = sDay
>> find_the_day sDay nDay =
>> let nextDay = addDays 1 sDay
>> if (is_trade_day $ nextDay)
>> then find_the_day nextDay (nDay - 1)
>> else find_the_day nextDay nDay
>
> The correct syntax is let ... in ...; you've forgotten the "in", so
> something like this:
>
> ,----
> | find_the_day sDay 0 = sDay
> | find_the_day sDay nDay =
> | let nextDay = addDays 1 sDay
> | in if (is_trade_day $ nextDay)
> | then find_the_day nextDay (nDay - 1)
> | else find_the_day nextDay nDay
> `----
>
> Note that in do-blocks you don't need the `in'; in "normal" code you do.
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> IvanMiljenovic.wordpress.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-----
fac n = foldr (*) 1 [1..n]
--
View this message in context: http://old.nabble.com/Why-cannot-i-add-the-%60let%60-declaration---tp27381811p27382334.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list