Carl's Blog

Researcher. Mountaineer.

Archive for the ‘CSLU’ Category

Code Golf

without comments

CSLU did code golf today. I did 1 and a half tasks, which were:

  1. Output the first 100 prime numbers
  2. Output e to 100 decimal places

Prime numbers

I’m quite proud of this, I managed to do this in 55 characters initially but then after some collaboration with the rest of the club shrunk it down to 49 characters

2.upto(541){|a|i=2;i+=1 while a%i>0;p a if i==a}

e

I never got his fully working as I ended up getting caught up in list comprehensions. Ended up with:

1 + sum [1 / (product [m | m <- [1..n] ]) | n <- [1..300] ]

 

Which is the same as e = \sum_{n=0}^{\infty } \frac{1}{n!} and shows how pretty Haskell is.

Written by carl

February 9th, 2012 at 11:35 pm

Posted in CSLU

Tagged with , ,

Fountain code challenge

without comments

For the second term of the 2011/2012 academic year I’ve made a small challenge for members of CSLU.

Details are found on the PDF.

Good luck.

P.S a bit of background reading can be found here.

PDF: CSLU Lent Challenge

Written by carl

January 21st, 2012 at 9:21 pm

Posted in CSLU

Tagged with , ,

Programming languages course

without comments

So I ran a talk on learning programming languages last week. It was the second time I had done that particular talk, and in this case the hardware setup went smoothly – as it was done by Stephen Wattam the CSLU VP.

We had a pretty good turn out, mostly of year year undergraduate students who so far had only played with a little C. I took pictures of everyone hard at work doing their task … well, ok. They were mostly on tryruby.org which was even better.

It showed that they had an interest in a new language which is fairly good at prototyping and will allow them to try out their ideas fast. I may have semi pushed them on to it in my talk, so I’m glad they were listening. No one tried learning Haskell though, but then I’ll drop in on everyone next term and see how they are doing. The slides and some info for my talk can be foundĀ  at the CSLU site.

On a side note … My Instagram tshirt came! I’m not sure if I’ll ever wear it outside as it’s a bit long, but still!

Written by carl

December 5th, 2011 at 6:12 pm

Posted in CSLU,Ruby

Tagged with , , , ,

CSLU Demo Prep

without comments

Well, this is getting rather fun, but quite time consuming.

My alarm clock is ticking away and my sleep time dwindling as I type, but I just don;t feel the urge to sleep yet. I’ve got a talk/demo I’m preparing for Wednesday for CSLU and it is getting bigger and bigger workload wise.

I’m hoping this translates to geeky hacky fun though.

The talk is on languages and paradigms, so I’m introducing a load of languages (8 I think, off the top of my head), describing the basic constructs, and then getting the room to build a “99 bottles” program using 3 of the given languages.

The fun, but time consuming, part of this is that I’m building cheat sheets for each language. Done the first one tonight, and it was for C, so quite detailed. Hoping I can cut/paste a lot of stuff for similar languages, and hoping I don’t have to fall back to a stock one. It is nice to make a custom one for the group, and also cements my own knowledge, especially of the languages I am unfamiliar with.

After the 99 bottles task, I am going to set some slightly longer challenges which can be made easier using certain paradigms. I have an OO one, which can be done procedurally. It’s based around a game scenario. For procedural I will probably do a processing batch type thing. For functional I need to do a little more research.

With the department allowing me to set up a load of VMs for everyone to use too, this should be pretty fun on Wednesday … so long as I get it all finished in time!

Written by carl

November 22nd, 2010 at 2:40 am

Posted in Academia,CSLU

Tagged with

Blogs and Wonder

without comments

Hello!

I have got the barebones of a new site up at http://www.jimhi.com so go and have a bit of a browse!

Also the Lancaster Computing Society has a development blog up!
Find it at http://compsocblog.blogspot.com/

Short post from me, all developmenty stuff is going on the Computing Society blog.

C

Written by carl

May 26th, 2010 at 8:50 am

Posted in CSLU,Jimhi

Tagged with ,