21 September 2009

an t-aonú lá don wombat ar scoil

Thosaigh mé ar scoil inniu. Bhí mé iontach neirbhíseach, agus ní raibh ach uair amháin codlata agam aréir. Ach bhí na daoine go léir cairdiúil, agus tá mé réasúnta suaimhneach anois.

I started school today. I was very nervous, and I only got one hour of sleep last night. But everyone was very friendly, and I'm much more relaxed now.

18 September 2009

Scoil

Ar naoi mbliana is dhá scór d'aois, tá mé ag dul ar ais ar scoil. Tosóidh mé De Luain. Ní bheidh mé ag freastal ar ranganna ar bith. Ina áit sin, beidh mé ag déanamh taighde chun céim mháistir a fháil (agus ansin, céim dhochtúra, le cúnamh Dé). Ábhar mo chuid taighde ná "intleacht shaorga". Ba mhaith liom na fionnachtana is nua ó thaighde intinne a chur le "líonra néarach" agus le "clárú géiniteach".

Is mór an t-athrú é sin, agus tá mé ar tinneall ar fad ag smaoineamh fá dtaobh de!

At age 49, I'm going back to school. I start Monday. I won't be attending classes. Instead, I'll be doing research for a master's degree (and hopefully a PhD after that). The subject of my research is artificial intelligence. I want to apply some of the latest findings from brain research to neural networks and genetic programming.

It's a big change, and I am a nervous wreck!

07 September 2009

Haskell agus Tionscadal Euler #6

Seo an chéad phost sa tsraith seo.

Mo réiteach féin do uimhir a sé:

(sum [1..100])^2 - sum (map (\x -> x^2) [1..100])

Tá mé sásta leis. Níor chonaic mé réiteach is fearr liom ar an fóram.

If you're wondering what this is all about, here's the first post in this series.

05 September 2009

Haskell agus Tionscadal Euler #5

Seo an chéad phost sa tsraith seo.

Mo réiteach féin do uimhir a cúig:

divisibleUpTo n 1 = True
divisibleUpTo n m = ((n `mod` m) == 0) && (n `divisibleUpTo` (m-1))

factors n = [m | m <- [1,2..floor(sqrt(fromIntegral n))], n `mod` m == 0]

prime n = null [m | m <- factors n, m > 1, m /= n]

lowestNumberDivisibleUpTo 1 = 1
lowestNumberDivisibleUpTo n = head [m | m <- [start..], m `divisibleUpTo` n]
where start = if prime n
then n * lowestNumberDivisibleUpTo (n-1)
else lowestNumberDivisibleUpTo (n-1)

main = print ( lowestNumberDivisibleUpTo 20 )

Bhí orm an "start" a úsáid mar bhí an cód ró-mhall gan é.

Fuair mé feabhsú níos giorra ar an fóram:

foldl (lcm) 1 [1..20]


If you're wondering what this is all about, here's the first post in this series.

31 August 2009

Haskell agus Tionscadal Euler #4

Seo an chéad phost sa tsraith seo.

Mo chéad réiteach do uimhir a ceathair:

reverseNum n = (read s)::Integer
where s = reverse( show n )

isPalindrome n = n == reverseNum n

factors :: (Integral b, Integral a) => a -> [(a, b)]
factors n = [(i,j) | i <- [1,2..floor(sqrt(fromIntegral n))], let j=floor((fromIntegral n)/(fromIntegral i)), n `mod` i == 0 ]

threeDigitFactors n = [(i,j) | (i,j) <- factors n, i > 99, i < 1000, j > 99, j < 1000]

isProductOfThreeDigitFactors n = not (null (threeDigitFactors n))

candidates = [n | n <- [100*100..999*999], isPalindrome n, isProductOfThreeDigitFactors n]

main = print ( head (reverse candidates) )

Tar éis leamh an fóráim, scríobh mé an ceann seo:

reverseNum n = (read s)::Integer
where s = reverse( show n )

isPalindrome n = n == reverseNum n

candidates = [n*m | n <- [999,998..100], m <- [999,998..n], isPalindrome (n*m)]

main = print ( maximum candidates )

Shíl mé nách mbeidh sé tapa go leor mar bhain mé úsáid as "maximum", ach bhí sé chomh tapa leis an céad cheann.

If you're wondering what this is all about, here's the first post in this series.

Haskell agus Tionscadal Euler #3

Seo an chéad phost sa tsraith seo.

Mo réiteach féin do uimhir a trí:

factors n = [m | m <- [1,2..floor(sqrt(fromIntegral n))], n `mod` m == 0]

prime n = null [m | m <- factors n, m > 1, m /= n]

primeFactors n = [m | m <- factors n, prime m]

main = print ( last ( primeFactors 600851475143 ) )

Tá mé réasúnta sásta leis. Ar dtús, bhí an chéad sraith 1..n, ach tar éis cúig bomaite, níor tháinig an freagra! Ansin, stad mé an sraith ag fréamh chearnach n, agus fuair mé an freagra gan mhoill.

If you're wondering what this is all about, here's the first post in this series.

Haskell agus Tionscadal Euler #2

Seo an chéad phost sa tsraith seo.

Mo réiteach féin do uimhir a do:

fib 1 = 1
fib 2 = 2
fib n = (fib (n-1)) + (fib (n-2))

fiblist = map fib [1..]

shortlist = takeWhile (< 4000000) fiblist
main = print ( sum[n | n <- shortlist, n `mod` 2 == 0] )

Ach nuair a léigh mé an foram agus cúpla suíomh eile, fuair mé cúpla fheabhsú:

fiblist = 0 : 1 : (zipWith (+) fiblist (tail fiblist))
shortlist = takeWhile (< 4000000) fiblist
main = print ( sum[n | n <- shortlist, even n] )

Fuair mé an sainmhíniú Fibonacci is cliste ón alt seo.

If you're wondering what this is all about, here's the first post in this series. The first bit of code is my own solution; the second is a much better one that I found on the forum.

29 August 2009

Haskell agus Tionscadal Euler

Tá mé ag foghlaim Haskell anois. Is teanga suimiúil ríomhaire é, teanga feidhmeána ("feidhmeán" sa chiall matamaitice). Agus tháinig mé ar Tionscadal Euler le déanaí, suíomh idirlín lán de fadhbanna beaga matamaitice. Is maith iad mar chleachtadh chlárú ríomhaire Seo mo réiteach do uimhir a haon:

multipleOf m n = m `mod` n == 0
chosenNumbers = filter (\x -> x `multipleOf` 3 || x `multipleOf` 5) [1..999]
main = print ( sum chosenNumbers )

Ach nuair a léigh mé an fóram, chonaic mé an chaoi is fearr liom:

sum [n | n <- [1..999], n `mod` 5 == 0 || n `mod` 3 == 0]

I'm learning Haskell now. It's a functional programming language (functional in the mathematical sense). And I came across Project Euler recently, which has short maths problems that are great for practising programming. The first bit of code is my own solution; the second is a much better one that I found on the forum.

27 August 2009

Xmonad

Bhain mé triall as Xmonad le déanaí, agus is breá liom é! Is bainisteoir fuinneoga é, scríofa as Haskell. Tá sé iontach mear, agus soshaincheaptha.

Recently I tried Xmonad, and I love it! It's a window manager written in Haskell. It's very fast, and easy to customise.