News aggregator

Merge with combining function

Haskell on Reddit - Mon, 06/23/2014 - 3:33am
Categories: Incoming News

image conversion

General haskell list - Mon, 06/23/2014 - 1:13am
Dear all, I have a problem, I am working on functional images and have now a problem that I need to write a function with the following signature convert::(a->b)->Figure a ->Figure b Where Figure a :: Pos -> a and type Pos= (Double, Double) For instance I have an Image chessBoard. chessBoard::Figure Bool chessBoard(x,y)= even(round x)==even(round y) I also have a function boolChar::Bool -> Char now I want to call convert like convert boolChar chessBoard which will give me an Image with the following type Char. How can I solve this problem? Many thanks, Peter
Categories: Incoming News

Problems with Parallel N Queens usingControl.Parallel.Strategy

haskell-cafe - Sun, 06/22/2014 - 9:49pm
Hello, Cafe, I'm currently reading Parallel and Concurrent Programming in Haskell. I tried to implement an n-queens problem as an exercise, but a little bit overwhelmed by the strategy mystery. The code is listed at I implemented the higher order skeleton of search and try to add parallelism. My original idea was spawning a few threads while the search tree was small and each thread handles the following expansion of the tree. Hence, I gave a "maxDepth" variable to restrict the parallelism. But this did not go very well if I set the maxDepth to very small value, say, 2, 3, 4 etc. The speed up was very small. Viewing in threadscope, it seems there was very small amount of parallelism. Then I tried to let it go, which means I set the tree depth to a value larger than the maximum possible depth, say 20. Then it speeds up about 1.4 times on 2-cores. Viewing in threadscope, it seems the 2 cores are fully utilized. But the report is a bit annoying: SPARKS: 4686728 (100456 converte
Categories: Offsite Discussion

An attempt at actors (looking for critique)

Haskell on Reddit - Sun, 06/22/2014 - 6:03pm

New to Haskell! I really like using actors, so I decided to try a simple implementation in Haskell to learn the language. I'm curious if anything here is either dumb, non-idiomatic, or both. I'm also interested if something similar exists in some library somewhere.

In this code actors can have any underlying datatype that gets operated on in the forked thread by putting messages on a Chan. The three messages you can send are:
-Message- maps a to a
-IOMessage- maps a to IO(a), to allow for IO operations
-Stop- writes to an IVar to synchronize with the thread that sends the stop message

data Message a = Message (a -> a) | Stop (IVar()) | IOMessage (a -> IO(a)) launch x = do chan <- newChan forkIO $ act x chan return chan act x chan = do message <- readChan chan case message of (Message y) -> act (y x) chan (IOMessage y) -> (y x) >>= (flip act chan) (Stop y) -> write y () submitted by JeanAugusteIngres
[link] [7 comments]
Categories: Incoming News

Danny Gratzer: Teaching Python with a Raspberry Pi

Planet Haskell - Sun, 06/22/2014 - 6:00pm
Posted on June 23, 2014

This last week I’ve been volunteering at a summer camp. This camp is aimed at kids ages 8 to 12 and teaches the basics of Python!

I wanted to write down some of my thoughts and experiences on the whole process.

The Curriculum

The curriculum for the camp was based around 3 key components

  • Python
  • Raspberry Pis
  • Minecraft

The camp was spread over 4 days, each 3 hours. Each day introduced more of Python with more sophisticated programs. Each program actually interacted with minecraft, building structures, modifying worlds, and doing cool visible things. We’ll talk later about how this was possible.

Going into the camp, the expected schedule was something like

  1. Introduce the Pi, show how to run Python scripts from terminal
  2. Introduce the basics of Python, mostly variables and conditionals
  3. Apply these basics with the minecraft API
  4. Introduce loops, apply this with a few more advanced programs

In hindsight, this curriculum was a tad bit unrealistic, but what curriculum isn’t.

The Staff

This was the first time the camp was run, so the staff was a little inexperienced.

I was the only person familiar with programming but had never taught young children before, and the two payed staff members were used to teaching basic science camps but had never taught anything CS-ish. This meant that a lot of this was a learning experience for us as much as the kids.

The Children

The camp was over-capacity with 14 children. None of them has ever programmed before per-se. But two had done some basic HTML layout and one 10 year old was quite familiar with unix after 2 years of running various Linux distributions (I was impressed).

The unfortunate fact was that since the camp was marketed as teaching with Minecraft, a lot of the kids just showed up to play Minecraft. This was anticipated but still a little saddening.

Day 1

On day 1, we get everyone set up with their own Pi, we also included

  • A cheap monitor
  • A very cheap mouse
  • A keyboard

Getting this all set up for 14 kids was a lot smoother than anticipated. The only hitch was the SD cards we’d purchased were a lot cheaper than anticipated so we burned through maybe 5 cards that we just couldn’t get a Pi to boot with.

We got everyone successfully to a desktop in about 30 minutes.

The Pis were running a custom operating system called Raspbian. This OS is very verbose during boot time and shows the entire log from booting up rather than just displaying an innocent little loading graphic.

Quite a few of the kids were curious about what was going on so we explained how little about how OS’s work. It was pretty awesome to see kids being interested in what steps a kernel went through.

Sadly I’m not a super knowledgeable person when it comes to OS’s. In light of this I’ve ordered a book or two on the subject, something that’s been on my todo list for a while now. I should be better prepared for questions next time.

Now once we got everyone up and running we had people order 2 programs, LXTerminal and Minecraft. This is when we had some fun trying to explain what exactly a terminal is.

I eventually started simply saying

LXTerminal is a program that let’s you run other programs. It’s like a text interface so that you can do what you normally do by clicking with typing.

Almost all Unix computers, like OS X and Raspbian, have the same way of entering stuff into terminals.

From here we had everyone run cd play. Luckily a group of volunteer engineers had sat down and written a bunch of programs to do various things in Minecraft. The first one everyone started with just built a grid of stone blocks.

We then started explaining how to run things with the python program. This turned out to be a bit more of a struggle than anticipated since typing and spelling are more difficult than anticipated.

We had a lot of people doing things like

$ pyton $ $ $ python # Finally

I really wish we had an overhead project to show everyone written examples on a teacher machine. This was a big problem as time went on, simply saying things out loud is not a sufficient method for communicating about programs.

Now, once this ran there was a satisfying “Whoooaaaa” when everyone saw that this command had modified the game right before their eyes!

Some people quickly started trying to use this to speed up their building by automatically creating walls for themselves rather than doing it by hand. This was exactly the response we were looking for and it was clear this was starting to spark some interest in programming.

Finally we had everyone open up IDLE. We used IDLE for all our editing purposes for exactly two reasons

  1. It’s dead simple to use
  2. It’s preinstalled

Everyone opened up and had a look at the source code. The code for was roughly

import minecraft import block mc = minecraft.Minecraft.create() # Our connection to Minecraft def buildWall(size, type = block.STONE): pos = mc.player.getPos() pos.x += 3 for x in range(size): for y in range(size): # Set block at these coordinates to type mc.setBlock(pos.x + x, pos.y + y, pos.z, type) if __name__ = "__main__": buildWall(5)

We get a pretty nice high level API to minecraft, and the code is quite simple. Keep in mind, we have taught exactly 0 python at this point.

Next we explained that we could change buildWall(5) to buildWall(6) and our program would make a bigger wall! Again an overhead was sorely missed at this point since it was very hard to explain exactly where we were talking about, even in such small code.

Most people than started modifying the code trying to build as big a wall as possible. This was also the point at which our first syntax errors started up.

Since I was the only person in the room who understood what they meant there was a fair bit of running around. I have to give a lot of credit to the two staff members who essentially learned the basics of Python syntax by me yelling it to them across the room! also included some code to generate a grid with different blocks. This was another huge success since kids could try to spell different words in their grid of blocks. I’ve omitted it from the above snippet since frankly I don’t remember it.

This took up most of the first day, since everyone also got a 30 minute snack breaks (don’t you miss snack breaks?).

Day 2

The next day we were actually aiming to teach some programming! This had a script written already by the engineers who’d written the code we’d used yesterday, but upon consulting the script I found

  1. Teach variables
  2. Explain what a value is
  3. Explain if’s
  4. Questions

Uh oh. So I ended up writing a few notes down the night before, we didn’t have access to any sort of projector so a lot of my explanations consisted of scribbling on a giant (2’ by 3’) post it note.

This had distinctly mixed results. As I’d expected most kids couldn’t pick up the fundamentals of programming in an hour! This was OK though since the rest of the day was spent messing around with a simple program

# import minecraft mc = minecraft.Minecraft.create() message = "Hello Chat" mc.putToChat(message)

And we used this to introduce the fundamentals of Python. For kids that were progressing faster, we challenged them to write more complicated programs like

import minecraft mc = minecraft.Minecraft.create() message = "" if 1 + 1 < 2: message = "Hello" else: message = "Goodbye" mc.putToChat(message)

Not surprisingly, this was really hard to grasp for our kids. This was when the class started to fragment a bit, some kids were getting this and really doing awesome while some were having a harder time with all the new information.

If I had a chance to do this again, I’d definitely split the class into two groups, one for people who were up and running with basic concepts to build some programs together with one instructor. The other two could then stay and give one to one help slowly but surely. This would prevent us from leaving anyone behind.

In reality I’d say we had about 5 kids who were understanding what was going on and 8 who were lost. No one had yet given up on programming luckily, so we were still more or less OK.

Day 3

Going into this day I knew it wasn’t going to be easy

  1. We were starting to lose a bit of interest since it’s getting later in the week
  2. Some kids were falling behind others

with this in mind, we went about introducing a few new prewritten programs that built cubes! I’ll leave it to your imagination how this worked, it’s pretty similar to

For the kids who were really clicking, I challenged some of them to explain parts of the code to me. In this context I taught a few kids about for loops. It’s a bit tricky to explain how they work since I didn’t want to explain what an iterable was. Remember, we hadn’t talked about any OO aspects of Python.

I introduced them to loops as something to the effect of

for VAR in range(NUMBER): STMT STMT ...

With the explanation that

A loop means we run that list of statements once for each number between 0 and NUMBER - 1 with VAR first being 0, then 1, then 2 and so on.

This seemed to click with most of them so quite a few got the hang of how loops worked.

I’d actually prefer I’d built some sort of abstraction like

def allPairs(*dims): ...

which returned an iterable (generator?) that had a list of all pairs possible within the given set of numbers. This would eliminate the need to talk about nested loops, which were a confusing subject for most people.

The tricky bit is that while I was hopping from person to person, the slower moving campers where playing with all on their own and not trying to understand the whole thing but still use it.

This worked surprisingly well actually, we were challenging kids to think about how to combine and to build things without ever laying a block by hand. Sadly a few kids just abandoned the effort and started playing Minecraft. This was not unexpected but still a little sad.

To keep things going, I wrote a little program which built a cube where the inside was filled with one thing and the outside was another. This meant that kids could build an upside down volcano or a waterfall.

Unfortunately, to get this to all the kids we had to hand write it on giant post-it notes and they had to manually type it. This is another case where we desperately needed a projector.

So the third day wasn’t nearly as structured as day 2, it was really a day when kids experimented and we tried to push kids individually. This actually seemed to be a great help since a few more kids had some breakthroughs on day 2 materials.

Day 4

Now, on the final day we opted to try something a little different.

We first tried networking the Raspberry Pis since kids had been asking to do this since day 1. Despite being able to get this working in prep time, we had some technical issues that prevented us from getting it working during the actual camp, very frustrating.

After the kids snack break, we went into a different room with no computers and put up a post it with the title “Steps for Writing Code”

  1. Define Our Problem
  2. Brainstorm Solutions
  3. Compare Solutions and Choose One
  4. Implement Solution
  5. Test Implementation

Now experts will notice the missing step 5.5, “swear profusely while implementation doesn’t work”. We will of course include this in a second level camp for teaching programming :)

Now I told them that their goal was to create a program which built a “sphere”. I put the quotes there since minecraft is built from blocks and doesn’t have a smooth sphere but you can get pretty close with bigger and bigger spheres.

So we went on to step 1. and everyone struggled to define what exactly a sphere was and how one ought to decide what “build it” meant.

We eventually settled on our problem being to build a sphere where

  1. A sphere is a collection of all blocks within a certain distance, D, from the center
  2. To “build” a sphere meant we’d place the center 3 + D blocks in front of us and we’d color all blocks in our sphere to stone.

Next came the lively discussion on how to actually go about doing this.

After about 5 minutes, we had a lot of hand-wavy solutions but not actual concrete procedure for doing this so I tossed out a hint.

I stated that if someone needed a procedure for finding the space between two blocks, I will implement a function dist so that

dist(x, y)

would return the distance between the x block and y block in three dimensions.

Now the solutions got a lot closer, people started listing steps of what to do. I encouraged them to treat me like the computer and give me directions. I would then walk around and “color” carpet squares. This seemed to demonstrate which solutions weren’t quite precise enough.

Eventually, we ended on a simple solution

Figure out the center by adding D + 3 to the current position. For each square in the grid S, if dist(S, Center) < D, color S

Very simple, very inefficient but correct. I then started talking about pseudo-code and turning this into a more executable form.

The kids who understood loops jumped in and we ended with something like

pos = mc.player.getPos() pos.x += 3 for square in fullWorld(): if dist(square, pos) <= D: mc.setBlock(square.x, square.y, square.z, block.STONE)

I let them off the hook here and wrote the rest of the code for them while they took a brief break.

We then adjourned into the computer room and got started testing! We had just enough time to have everyone gather round while we built a Death Star on the teachers machine (I was the fastest typist).

Quite a few of the kids where interested in buying their own Pis and continuing on their own so we gave everyone their SD cards and directions on how to acquire a Raspberry Pi. I also gave out my emails to a few of the kids who wanted to make sure they had someone answer questions when they were setting up their Pis.


So dear reader, where are we left?

Well the place that ran this camp is running more. I’m not sure if they’re full, but if you’re a parent or interested kid, please email me at [jozefg AT].

If you’re thinking that you want to run one of these camps yourself, do it! I only have 4 pieces of advice

  1. Error on being concise and simple rather than comprehensive

    You’re not going to teach someone to program in 4 days. You can however, make someone hate programming forever in 4 days! If they kids want more information, they’ll ask.

    I guarantee that you’ll end up flooding the kids with too much information if you try to be comprehensive.

  2. Always run this with more than one adult present

    Otherwise you’ll end up spending the whole camp chasing after kids to fix issues and everyone else will be bored.

    It’s always good to have more than one adult who knows Python too! You can do it with just one I’ve discovered. It is less than ideal however.

  3. Have a good space, with a projector!

    Projectors are great. So great that I’m very seriously considering buying one for the next 2 iterations of this camp.

  4. Inspire kids to want to learn more!

    That’s the whole point! You’ll never teach anything if you’re fighting the kids. Make this fun and don’t sweat it if you feel like you’re not covering as much material as you’d like. This isn’t a class, there’s no exam at the end, it’s supposed to be fun!

If anyone has any more specific questions on this camp, please comment below and I’ll respond as soon as I can.

<script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'codeco'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + ''; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript> comments powered by Disqus
Categories: Offsite Blogs

'ghc-make' released

Haskell on Reddit - Sun, 06/22/2014 - 5:30pm
Categories: Incoming News

Robin KAY: Windows Qt binaries for the Haskell Platform (HsQML)

Planet Haskell - Sun, 06/22/2014 - 3:49pm
Since upgrading to Qt 5, the installation procedure for HsQML, my Qt Quick binding for Haskell, has been been less than ideal on Windows. This is because the official Qt SDK for Windows now uses a much newer version of MinGW than ships with GHC or the Haskell Platform and the two are no longer binary compatible. Binaries compiled by GHC using these Qt libraries simply crash on start-up.

It has always been possible to work around this problem by modifying GHC's configuration files to use the C compiler from Qt's MinGW rather than its own. However, this is a rather awkward thing to have to do and, regrettably, the instructions on my web-site for doing it weren't terribly clear.

I have now produced a special build of Qt 5.3.0 using GHC's MinGW which should work out of the box. The download and updated instructions are available from the Windows section on the HsQML web-site. Hopefully this will make getting HsQML running on Windows much simpler.

Longer term, GHC ticket #9218 tracks updating the version of MinGW which ships with GHC to something more recent.

Technical DetailsI began by making a straightforward build of ICU 53.1, which is a Qt dependency, and then configured the Qt source tree to make a release build using the desktop OpenGL graphics stack as follows:

configure -opensource -release -opengl desktop -no-angle -skip qtwinextras -prefix C:\qt530-hp

The one oversight here was not using the -no-sseX flags to limit the use of instructions set extensions. I presume therefore that build targeted the host machine and may not work on processors which don't support SSE 4.1 or later. The QtWinExtras module relied to too heavily on functionality missing from the older MinGW headers and so I had to disable it.

Once the build was under way I ran into a few minor tool-chain issues which I resolved as follows:-
  • Remove some flags which are unsupported by the older compiler. Namely -fno-keep-inline-dllexport in qtbase/mkspecs/win32-g++/qmake.conf and -Wno-error=unused-but-set-variable in qtwebkit/Source/ThirdParty/leveldb/Target.pri.
  • Redirect required symbols missing from MinGW to suitable alternatives. Namely YieldProcessor to _mm_pause, MemoryBarrier to _mm_mfence, strcasecmp to _stricmp, strncasecmp to _strnicmp, strdup to _strdup, _exit to _Exit, and _MAX_PATH to MAX_PATH.
  • Change the name of the GUID member of the VMRGUID structure in MinGW's strmif.h so that it doesn't have the same name as its type.
  • Add the missing header file delayimp.h by copying it from a newer version of MinGW.
When I repeat this process for the next release of Qt 5, I will prepare a proper diff against the MinGW headers to make this set up more easily reproducible.

Finally, when testing the resulting binaries, I found a MinGW-specific bug which had been introduced in the Qt 5.3 release and causes it to intermittently crash. This has been filed as QTBUG-39793 and the patch attached to that bug was applied to this build.
Categories: Offsite Blogs

Neil Mitchell: Announcing ghc-make

Planet Haskell - Sun, 06/22/2014 - 2:47pm

Summary: I've released ghc-make, which is an alternative to ghc --make.

I've just released v0.2 of ghc-make (on Hackage, on Github). This package provides an alternative to ghc --make which supports parallel compilation of modules and runs faster when nothing needs compiling. To unpack that:

  • Parallel compilation: Call ghc-make -j4 and your program will build by running up to four ghc -c programs simultaneously. You usually need at parallel factor of 2x-3x to match ghc --make on a single core, since ghc --make does a lot of caching that is unavailable to ghc-make. If you use -j1, or omit a -j flag, the compilation will be based on ghc --make and should take the same time to compile.
  • Faster when nothing needs rebuilding: If ghc --make is slow when there is nothing to rebuild, and most of your executions do no rebuilding, ghc-make will make things go faster. On Windows I have one project where ghc --make takes 23 seconds and ghc-make takes 0.2 seconds (more than 100x faster). Particularly useful for scripts that do ghc --make Main && ./Main.

See the README for full details.

How do I use it?

Install ghc-make (cabal update && cabal install ghc-make). Then replace your calls to ghc my -arguments with ghc-make my -arguments. Almost all arguments and flags supported by ghc are supported by ghc-make - it is intended as a drop-in replacement. Let me know about any bugs on the bug tracker.

To use ghc-make with Cabal, try cabal build --with-ghc=ghc-make --ghc-options=-j4. (This technique is due to the ghc-parmake project, which also does parallel ghc --make compiles.)

How is it implemented?

This program uses the Shake library for dependency tracking and ghc --make for building. The actual ghc-make project itself only contains 4 modules, and the largest of those is the test suite.

To pass options to the underlying Shake build system prefix them with --shake, for example --shake--report=- will write a profile report to stdout and --shake--help will list the available Shake options.

Categories: Offsite Blogs

An experiment with typed time

Haskell on Reddit - Sun, 06/22/2014 - 2:31pm
Categories: Incoming News

Professorship Available

General haskell list - Sun, 06/22/2014 - 10:41am
Dear All We are looking for a new professor and Head of Department at Strathclyde. People on the Haskell list might be interested as there is a significant amount of functional programming done here so you should find fertile soil to put down roots. Details can be found at If you are at all interested, even vaguely, then please do drop me a line. Always happy to chat …. All the best Neil
Categories: Incoming News

Help explaining fusion code example (and some rookier stuff)

Haskell on Reddit - Sat, 06/21/2014 - 4:37pm

Ran across the code below which reads doubles and returns the mean without ever creating a list.

mean :: Double -> Double -> Double mean n m = go 0 0 n where go :: Double -> Int -> Double -> Double go s l x | x > m = s / fromIntegral l | otherwise = go (s+x) (l+1) (x+1) main :: IO () main = do [d] <- map read `fmap` getArgs print (mean 1 d)

Source Link:

Question 1: How do I run this? I try ./mean 1.0 2.0 3.0 and get user error (Pattern match failure in do expression at [map read line])

Question 2: What is 'd' in this case? a special variable that's mapped for input?

Question 3: the method signature of mean is super confusing, takes two doubles, returns a double... where does it get the values it performs the tail recursion on?

Thanks for any responses been trying to wrap my head around it for a while now.

submitted by ltjbr
[link] [6 comments]
Categories: Incoming News

ANNOUNCE: blank-canvas

General haskell list - Sat, 06/21/2014 - 3:44pm
Announcing blank-canvas 0.4.0, a Haskell binding to the complete HTML5 Canvas API. blank-canvas allows Haskell users to write, in Haskell, interactive images onto their web browsers, via a specialized JavaScript DSL. First Example: {-# LANGUAGE OverloadedStrings #-} module Main where import Graphics.Blank -- import the blank canvas main = blankCanvas 3000 $ \ context -> do -- start blank canvas on port 3000 send context $ do -- send commands to this specific context moveTo(50,50) lineTo(200,100) lineWidth 10 strokeStyle "red" stroke() -- this draws the ink into the canvas There are around 50 examples on the blank-canvas wiki: Enjoy! FPG< at >KU _______________________________________________ Haskell mailing list Haskell< at >
Categories: Incoming News

Stack traces in GHCJS

Haskell on Reddit - Sat, 06/21/2014 - 12:00pm
Categories: Incoming News

Douglas M. Auclair (geophf): keepEquals with Difference Lists

Planet Haskell - Sat, 06/21/2014 - 11:35am

Yesterday's 1HaskellADay exercise was keepEqual but it could have easily have been ‘keepSimple’ or ‘write this in your sleep’ or ... something like that.
It was a good exercise, because there’s the obvious solution but then you look to improve the efficiencies.
And then, of course, there’re the wrong solutions, but that’s what we have proofs for, to prove ourselves into the correct implementations.
So the first stab I did was wrong:
keepEqual1 : Eq a => List a -> List a -> List akeepEqual1 list1 list2 = list1 >>= \h1 =>                         list2 >>= \h2 =>                         (if h1 == h2 then return h1 else [])
The problem here is that this algorithm, albeit cleverish is, well: wrong.
It iterates through each element of list1, fine, but it compares the currently-selected element of that list to every element of list2.  There’s also a tiny problem in that if either list1 or list2 are infinite, see, as the binding operation goes through each element of the list (inner, then outer) before returning, which could be a problem if you ever want a return in this eternity.
Minor problem there.
The other problem is that this is an exponential algorithm: for each element of list1, it possibly iterates through the entire set of list2 to find a match.
So. Cleverish approach was a fail on my part. Shall we try the traditional approach?
keepEqual2 : Eq a => List a -> List a -> List akeepEqual2 [] _ = []keepEqual2 _ [] = []keepEqual2 (h1 :: t1) (h2 :: t2) =   (if h1 == h2 then [h1] else []) ++ (keepEqual2 t1 t2)
So, that’s traditional. That works (and we can choose to verify that it does work), and it terminates at the end of the first list, thereby neatly dodging the non-termination-with-infinite-list-arguments issue.
The problem here is that we are representing choice with a list-compressionescque algorithm here, so we continuously concatenate to the end of a single-element list, or, in the case of a non-match, the empty list.
That algorithm, concatenation-no-matter-what, just screams: “Improve me! Improve me, please!”
So, okay, one improvement is we can turn our choice-point from the above to construction or return:
   (if h1 == h2    then (h1 :: (keepEqual2 t1 t2))    else keepEqual2 t1 t2)
Okay, is that yummy-looking?
No. No, it is not.
I mean, for efficiency’s sake we are eliminating the whole ‘concatenate after the empty list’ operation for the not-equals case, and keepEqual2 is being called only once in this branch, but ...
But it’s still written twice, and that’s ugly. Why do we have to express something twice for the concept of ‘okay, add the head only if it’s the same and then continue on with the rest of the two lists.’ I mentioned the continuation (ooh! continuations!) just once here in my denotation, why do I have to mention it twice in my implementation?
Well, I don’t have to, actually. We’re working in a functional domain, so let’s get functional!
   (if h1 == h2 then ((::) h1) else id) (keepEqual2 t1 t2)
Boom! ... actually, not so ‘boom’ because of the overridded values of (::) confuses Idris (Vect, Stream, and List all use (::) as a constructor), so let’s clarify that:
cons : a -> List a -> List acons a list = a :: list
So, now we can write:
   (if h1 == h2 then (cons h1) else id) (keepEqual2 t1 t2)
I actually had this little partial function revelation just now, so my actual implementation involved me creating the difference list data type, which allowed constant time prepend and append operations. Which is better? Partial functions or the difference list?
Well, let’s take a look at my difference list implementation so we can judge their respective merits.
data DList a = DL (List a -> List a)
A difference list is the difference between two lists, and we represent this difference by capturing it in a function
unDL : DList a -> (List a -> List a)
And we can, of course, extract our function from the difference list type.
(<<) : DList a -> a -> DList alist << a = DL ((unDL list) . (cons a))
Our append operator (<<) appends an element to the tail end of a DList in constant time (if it were needed, the corresponding (>>) operator prepends an element to the head of a DList, also in constant time).
So, we have our DList structure, but we need to start from something, and then, eventually convert back to a plain-old List structure. The below functions provide those functionalities for us:
emptyDL : DList aemptyDL = DL id
dlToList : DList a -> List adlToList dlist = with List (unDL dlist [])
Now, with the difference list type, we rewrite our keepEqual in the natural style.
keepEqual : Eq a => List a -> List a -> List akeepEqual’ : Eq a => DList a -> List a -> List a -> List a
keepEqual = keepEqual’ emptyDL
keepEqual’ dl [] _ = dlToList dlkeepEqual’ dl _ [] = dlToList dlkeepEqual’ dl (h1 :: t1) (h2 :: t2) =   keepEqual’ (if (h1 == h2) then dl << h1 else dl) t1 t2
So, what do you think? For this example the DList doesn’t really shine all that much, but if we had something where appending to the end (in constant time) made a whole lot of sense, then we would have a clear win for it.
I like DList.
Categories: Offsite Blogs

I feel like I'm in r/vxjunkies

Haskell on Reddit - Sat, 06/21/2014 - 11:00am


I'm new to Haskell. I've read LYAH, and feel as though I have a very basic grasp of Haskell. However reading through a lot of the threads on this subreddit make me feel like I'm on r/vxjunkies. Did anyone else feel like this when they were first learning, or am I just a complete idiot that needs to give up Haskell right now?

submitted by unimpaired
[link] [47 comments]
Categories: Incoming News

Audrey Tang: Panel Transcript

Planet Haskell - Sat, 06/21/2014 - 10:54am
2014-04-27, TEDxTaipei,
Hazel (Moderator), Linda (RailsGirls), Charles (JRuby), Matz (Ruby), Audrey.

Hazel: Now, we go for the first question. Are you all ready? The first question is "Today, working independently is no longer popular anymore. Team cooperation has become a trend in the age of cross-discipline working."

“What we learn from programming — will it help us to do a better job in real life? Maybe  — for the males and for females — for everybody."

Linda: Hello. I suppose that when people told me that learning to program teaches you how to think, I didn't understand it in the beginning. On learning, I've worked with engineering teams a lot. It really helps you structure it in a way that it needed for the engineering to work on problems.

For instance, I would come up with a feature, and they'd go, "Hey, OK, let's do this." And by being able to understand how the code works, or how that product is built, or what kind of features are feasible to build, and so forth, even though I didn't work as an engineer, helped me work better and more efficiently.

[laughter and applause]

Charles: It's interesting, because just in the past few weeks, my wife has decided to start to learn how to program. She's very excited about the possibilities. She was a little frightened at first, of the difficulties she might run into. But, for years, she's been the primary chef in the house. She's taken care of the kids. She's knitted. She's done other crafts and projects,

What she started to see is that what she's learning in programming fits very well with other methodical, recipe-type systems, and building of crafts, building of a meal, things like that, as tying into the rest of her life, the more that she picks up programming. It's been exciting to see that.


Audrey: Since Linda and Charles have addressed programming’s importance so well, I’d like to talk a little bit about the team working part. I think part of being an audience —  as we know — being an audience is the ability to listen.

I think a lot of the experience in programming nowadays online, whether it happens on GitHub or other social events, is the ability to listen, or to perceive, or see each other's viewpoints. We see that on GitHub issues, we see that on mailing lists, we see that on IRC, we see that on wikis.

I think, those taken together is much more important than code itself. As we would see that code itself, as why the lucky stiff re-tweeted, that code never lasts long anyway. It's always replaced by something new.

But human memories, the shards of the souls that we share together, those may not be as precise as code, but they outlast code. Community, people, their relationships, their links, they outlast code.

Code is this wonderful opportunity as an anchor for us to learn to listen to each other, such that we can make something more beautiful and that's objectively there. It's like an artifact, a pyramid or something that we could see, growing day to day objectively, as a result of our being generous to each other.

I think being able to listen, and to be able to give back is the most important thing for us to learn as part of programming in the teamwork that's the future. Thank you.


Matz: I think I have to say something.


Matz: Despite the original question, in the past, the creating serious software is not this independent work, so they couldn't create the serious software alone. They have to work in the same company and in the same project, then working together as a team, maybe in the hundreds of programmers to create the systems like IBM’s System/360 or something.

But there are technologies that change the situation, like, for example, Ruby. Ruby was started by me alone as an amateur programming language designer. I created the first snowball and put it into the Internet, so that everyone gathers together. Then we work together over the Internet.

Ruby's getting better and bigger, the committee has grown, and JRuby has been created, and then Rubinius, and so many projects with Rails, or Sinatra, or even other communities like the RailsGirls, that sort of thing. That means we can be more flexible using technology.

We can work alone, the individual can start great things using the power of the Internet. At the same time, using — say community, Internet, or even GitHub —we can be socialized to form the power to create great thing by programming.

I believe that is the flexibility, like from individual to huge community, like millions of people. We can choose, not by the company, not by the project, not by the organization or something. That kind of flexibility is the power of the 21st-century I believe.

Charles: One more thought. It occurred to me that one of the biggest advantages that you'll get out of learning how to program, is the fact that you're going to be able to cooperate, and understand, and work with other programmers, which there are more and more of us.

There's more software being created every day. It runs the world, and being able to be part of the world, I think means that almost everybody should learn how to do some programming. You've got to understand how the world around you works. It also, as Matz was talking about starting Ruby, you don't know if that piece of code that you write tomorrow, that one project that you build, might be the seed that grows into a forest.

The project that Matz started years ago is why we're all here, why we have wonderful events, why we're creating such amazing applications. It could be any one of you. You could be the next one to create something that grows into that forest of a wonderful programmed world.


Hazel: Could you provide some advice for people want to promote programming, to avoid a situation of this [gender exclusion]. May you, Linda, can share some ideas about that. What can you think effectively reduce these uncomfortable situations like this? Maybe in the case, or your ideas, please for Matz, and for Charles, maybe you can share what you see in this IT industry.

Audrey: Hazel refers to a private conversation we had before the conference, and the basic point was that Taiwan, which is culturally influenced both by the Japanese stereotype of women, and also by the confusion Chinese treatment of women.

There is this sense of a politeness that's built-in, not only into women, but into everybody, so that when we are joining a community, we tend to reach a safe point where we think that we establish some sort of sympathy, or empathy, or understanding with the group, before we even start to speak, or even we start to raise our hand. This is a very East Asian thing.

But in particular for women, if they see a whole space composed of men, or of people who are gender expressions that differ so much from theirs, it's very difficult to establish this kind of rapport, or mutual support sense, before starting to join, or start participation. That's a real entry barrier, as Hazel mentioned herself. It's an artifact of the community's composition, and the culture of things in Taiwan, or in East Asia.

It's not specific to women alone. As for how to fix this, well some people do that by sheer obliviousness, like to their social scripts. They are like, "Well, we shall dive in right here."


Audrey: When they just jump into a community and start asking stupid questions, some people would say, "Hey, why are you here? You're out of line there, right?" But then [laughs] after a while, they start to become part of the community, and that's actually the fastest way.

As Matz actually implied, the fastest way to get a community going is by releasing something imperfect. It's about like posting your question, and then answering it in a very bad way. A lot of you would join saying, "Hey, there's a better way to do that."

So people who are oblivious to this kind of social training, they could actually enter that kind of online technical community much easier, and with much less difficulty — even after a lot of argument ands fighting — than people who are polite, and than people who then shift into some other community who are more friendly, like making digital art, or things like that.

Actually, a suggestion I would make is to be strategically oblivious. [laughs] Just to make some headway into it, pretending that you're already part of the group, and that's a self-fulfilling prophecy, and you will become part of the group in no time.

Linda: I segue into it with a very personal experience. I wasn't a professional programmer, and still I'm not a professional programmer, besides so I was absolutely oblivious to all of that life, all of that trauma, and all of the drama that surrounded the female in technology, and that sorts of problems.

I just wanted something that helps me learn more programming. I didn't know that the word “girls” would offend many Americans, and I’d like to think I was able to build this platform because I’m not a native speaker, I didn't know that they're supposed to teach programming in this manner or that manner.

There were so many things that we didn't know, which afforded all of us to experiment, and do things and not worry too much about what happened.

I totally agree with the thought that, that the best way is to barge into a community and start asking questions, but I come from a culture that it also very important to be like others. Finnish people tend to be relatively silent and observe, than raise questions. One of the things that I deliberately wanted to have in the RailsGirls workshops was some sort of cultural section, where we talk about people — like who are the people in the Rails community.

We talk about Matz, we talk about DHH , we talk about _why, and we talk about the FridayHug. We talk about all of these other institutions and things that I'm quoting, because it's not only about the code.

Then we encourage people to become a part of their local group, and coming to these events, and have the self assurances that, "OK, I know enough to be able to go into a meet-up, and be a part of something bigger. I'm probably still not there technically, but I’d love to see DHH again.


Charles: One of the things, I wanted to make sure, it's been said in various ways all day today, but you ever feel like you're being excluded, or singled out, just always remember, it's not your fault.

Everybody's going to face that, not just the programming community. Ask any over-40-years-old programmers how welcome they feel in Silicon Valley, San Francisco, and it's that sort of thing. Look, it's not your fault, and remember that the reason we have events like this, and the reason this has become such a major issue, a feature point of discussion, is because we're trying to fix it.

There are resources that will help you avoid that exclusion, that ostracism from the community. Just keep fighting through it, and we'll try and help you as much as we can along the way.


Matz: Yeah, it's on. Yeah, just for a little more.

Matz: [laughs] In CRuby, we had say 90-something core contributors who had the privilege to commit to the central repository. Some of them are Japanese, some of them are living in the United States, and some of them are European. I don't know who any of the Taiwanese or the Chinese. Unfortunately, I know no female contributor yet, but I'm pretty expecting.

Actually, I don't care about this aspect, that gender, and nationalities, and age, and titles, anything. We had very young contributors like 18, or something, and very old contributors like 50s, 60s. But actually, I don't care. As Audrey said, we want to value people by their values. I think that being fair, and that don't care too much about the other attributes is that crucial for the community management.

Our community has a very good tradition to be nice, so the Ruby community is known to be nice people. As Linda said, the community, or the open source, or even Internet, is a human thing, so we are human, and we have hearts. The communication between hearts is the very important even in the software programming, software creation, or anything.

Charles: Sorry, just one quick inspirational story. I went to a conference in Tunisia in 2013, and it was about 100 people for a Java event. Very first time, done at a technical university in Tunis, and the conference, and the University had a majority of women. It was the first time I'd ever seen that anywhere in the world, and I was amazed by it.

But they were really excited, and they were pretty much in charge there. [laughs] They were running that thing. But it was just great to see that there are parts of the world where they were already getting that going, and starting to get more women involved in technology. I'm just thrilled that it's happening here, and happening around the world.

Thank you to Linda for arranging this, and for the Rails Bridge folks for doing the sessions they're doing in the US. It's really an exciting time, and I'm glad that there are so many more interesting, wonderful programmers entering the community now.

Linda: Yesterday in RubyConf Taiwan, there was a lot of RailsgGrls alumni who participated, and volunteered over there, and helped organize the event, and I think it's almost like a fairytale that all of the sudden we would have hundreds of women taking part as speakers in conferences.

But I do wish that all of you who volunteered yesterday will keep on programming, and next year you will probably give a talk over there, and be there, and we will have more women as speakers, or so in conferences.

Hazel: RailsGirls hosted this event, so let's talk about the RailsGirls community. According to your observation, what are the factors in this community that encourage female to access programming?

Linda: I think that might have a lot of broadening up, because RailsGirls, again was a very personal thing to teach myself programming, and it's definitely not a panacea to every single female, like getting more females in programming world, and as Charles mentioned, there's a lot of organizations that are doing wonderful work for this in very different ways. Can repeat the question? What was that?


Hazel: Maybe we can change the question about what is the factors? Linda: Yeah, what are the factors in general in bringing more females to programming? As I mentioned in my talk, for me it was the practical application, the expressing myself and the creative side of things that initially gave me that aha moment, and I think there's almost two types of click moments in programming:  There's the very tangible moment when you see something come alive on the screen, and like, "Oh wow, I made that?" Then there's the more intellectual pleasure of seeing something like beautiful code that is formulated, and getting that "Whoa," an intellectual aha moment.

Sometimes our schooling system aims for the latter one, where we learn about arrays for a long time, and before having that tangible moment of aha. Maybe one way of getting more women involved in general is to have more of those first moments.

Audrey: To extend the analogy, I'd like to introduce the question, "Why do people write poetry?" People write poetry because they feel very strongly about something. Because of that, a lot of teenagers write poetry, because they feel very strongly about something.


Audrey: Only a few of us continue to write after our teenage. But in any case, that was the spark. That was the first moment. If you, whatever your gender or age, if you start caring very much about something, there's got to be way that programming is going to be helpful to make that happen.

As a rule, either there is a way to reduce your stress in automating some of the tasks, or as a way to get your message across, or as a way to get more community around you, or to get better equipment so that you can do whatever you care about more efficiently. There's going to be some way that programming, like a good mastery of language, is going to help you to communicate to other people.

And that’s Linda’s second point, when you see that the poetry you write touched another person’s heart. They come to you and say, "Hey, I read your poem, and it touched me very much, and I was crying," or something — just by reading your poem. Then you get the sense of accomplishment, of having touched another human being with something you created.

It's actually very easy to do, especially with web programming nowadays, so that's another thing that one can focus on in getting your message across, not only with the existing web systems like Twitters, or Facebook, or something, but with something that you design yourself — even though it's with iframes and entry level CSS — because it has an impact, because it is you; it is a part of you. It's part of your soul, and not just some post on some blog system, or on some social network system. Thank you.


Charles: I'd say one of the biggest factors that is going to make it easier for women to enter the programming world is exactly what you all are doing, having more women in the community, more women that can identify with new programmers that are coming to the community.

You're helping lay the foundation of all future generations of women programmers. You're helping open that door, and make it more attractive, make it more comfortable for women in the future to become programmers.

Don't forget that it's an amazing thing that you're doing, for all those future generations that would have had the same trouble that people had 10 years ago, or 20 years ago, trying to get into the sort of field, so just keep up what you're doing, because you're really helping. You're helping all the women in the world at this point.

Matz: I have never written a poem in my life, but according to the old saying, the poem is the outcome from the passion inside. If it's true, the Ruby itself is my poem. There are 600,000 lines of [laughs] C-code poem that's used.


Charles: Yeah, an epic poem.


Audrey: It is also very poignant.

Matz: But anyway, the primary motivation behind the creation of Ruby is the passion. My passion of the love to the programming language. Loving programming language sounds weird to most of the people, but I can't help it. [laughs] Since I was in high school, I loved programming language, so the very important thing is the following passion.

Maybe so you ladies, girls and boys in the field, somewhat passion to create something, and then you see the screen that your software writing on, so you feel something good. That is the passion that you start with, so that passion brings you to be better programmer, better creator, or even artist.

If I say something, so follow your passion, and then nourish your passion. That's a very important things to be a better person maybe.

Hazel: Please, everyone give the applause for all four of them first.


Hazel: This is really, really exciting, right? I know many of you sitting on the seats have not attended a programming course, or the coding process before. I want to ask a question. Do you want to learn programming? If you want, please raise your hand. Raise your hand higher, higher. [laughter] . Please, OK. Please don’t put your hand down. Please, we'll hire you soon.


Hazel: Is there any programmer right here want to teach all of them, please raise your hand. Wow, see, there is too many hands right in the air. I think this is really possible. If you are really want to involve in this community, you want to learning, just ask them to teach you, and maybe like the RailsGirls, you can establish your own community. Maybe in a different language, a different city, different area, that's all possible.

Last, I want all of you please give some words to the audience, sitting on the seats, to encourage them to pursue learning programming, or maybe they want to do something else. Could you give some words?

Audrey: I'd like to invite you to be yourself. There's a lot of going on in Taiwan where you see on the magazines, or on the books, that have to be as successful, or as interesting, or as fashionable as some person that appears on the cover of a magazine, or a book. There's all sort of this kind of going on. I'm sure it's a worldwide thing.

But I'd like to encourage you to think that if you follow the ways outlined in those magazines and those books, the best you could do is to just be a very good copy, or even a better copy of someone else. But that's not something irreplaceable. That's not something authentic, and that's not something that's authentic to you.

I guess the only way, for me at least, to follow your passion, is to think back of what are your unique experience that makes you care about the things you care, that makes you feel the things the way you feel, and then from it discover a ground for you to be authentic with yourself, and without exception, I think passions and compassion will follow from that. Thank you.


Charles: I love to read sci-fi novels, and fantasy novels, but I still love to watch the Hollywood movies, science fiction, but in reality we have no ESP, and we have no magical power like Spiderman or Superman, but right now though, we can control the computers.

We can control the network, so we can communicate to the people all over the world in a second, the speed of light. That's a kind of magical power. I believe the programming is the magical power that enables the imagination to be real, so learning, and having ability to program computers, is to order computers to use some magical things. Learn program, be a magician, be a wizard, and be happier.


Linda: I'm still pretty much figuring out what I want to be when I grow up, and what I want to be doing.


Linda: I've had the exact same idea. I've gone through all of my life and tried to figure out what are the points that made me who I am today, and the things that I do what I do. The first of them is from age eight, I think. Then I run into this quote from Steve Jobs, who was talking about connecting the dots. How you can connect dots only looking backwards, not looking forward.

Then I looked at the sky, and I don’t know if any of you know who came up with constellations, like the shapes that stars form, but it wasn’t scientists, it wasn’t engineers, it was the storytellers.

The people who wanted to make sense of the sky by drawing pictures in there, and calling, “This is an owl, and this is a donkey.” In the same manner, I've been trying to figure out what are the individual dots in my life, and what kind of a picture they form.

Those pictures can change throughout time, and there might be different kinds of connections, but it's important to have those dots in the first place, and to start thinking about what they form up. It's as you said, very individual, and very unique, and it shouldn't be something that you just copy from someone else.


Matz: I'm a little biased, but honestly, I believe that being able program is the most powerful skill that a person can have. It requires essentially no resources. It helps to have a computer, but essentially it's all just from your mind. It's what you can create.

Anything you can imagine, you can create, and you don't have to have anything but time, and effort, and energy to do it. Once you start to get into this, it's almost like a drug. You're going to feel how powerful you can be, and how much you can do with programming. Get through the early tough stages, because it's a great ride, and it's really exciting.


Hazel: OK. Thank you for you. I received some questions from the audience, but before we answer the questions. Are there any more questions that you want to ask, are there any notes you want to pass it to the stage, is there anyone or this is all the questions?

Hazel: Is there anyone? No? Let's start the Q&A panel. I think this question is for the programmers to answer. What makes you want to push girls to attend this event, and what impact do you think can make difference to girls who are involved in this event?

Audrey: The question was, really, I think, about what impact that we think that people who are involved in this event, what kind of differences those events make to the women's lives who attend these events. That's a very good question, actually.

When we talk about pushing someone to compel themselves into taking up an important social task, the way we do it is with finesse. It's about raising something, a spark that kindles in them something they already care about, but they felt that it’s helpless, maybe because they believe that they're the only person on earth who cares about this issue, or maybe they believe that the system is too large, it's too immutable, people cannot change just by themselves, and things like that.

I think programming in itself is a way to empower people, to see that there are millions of people in the world who put in maybe just five minutes a day into something. Or if you're really addicted, 15 hours a day into something…


Audrey: …it visibly makes the world better. I think that impacts a person's life, empowers them in ways very few other fields that could provide.

Charles: I'd say I have selfish reasons. Pretty much every programmer I've ever met has taught me something. If women are not part of that community then there are things I'm not learning. I want everybody to be part of this community, so that I have a chance to meet and talk with you about programming some day.

It all goes around. The community can't work without the community. It has to be filled with lots of different people, lots of different ideas and different ways of looking at things. It's not even just for you. I think it's absolutely crucial to the programming world, the IT and tech world, to bring more minds in. This is a great way to do it.

Linda: For the RailsGirls event, we oftentimes say that you don't learn much about programming, per se, in one weekend and especially using Rails. But you do get to meet the coaches, so you do get a real connection with a real programmer, and then you get to meet all the other women who are as excited about technology as you.

Here in Taiwan you see a lot of women in events. But we've had events in Egypt or Cairo or Azerbaijan, where they just don't even know other women who exist who are excited about this stuff. It's a very powerful thing to fashion, to meet the people.

Matz: The motivation and the background is up to each individual, like to gain new knowledge or to improve their income by learning programming. But no matter which motivation you’re behind, I really want you to understand the programming itself is pretty enjoyable. It's fun. I have been programming for more than 30 years. I have never been tired of it. It's very exciting. I often forget to eat, I forget to sleep.

[laughter and applause]

Matz: Yeah, it's fun, that much. I want you to understand the fun, the joy. Well, plus, you have your individual motivation, and plus knowing that fun will improve and even enhance your individual motivation.

Hazel: After the first question, here comes the second. It's also related to the first one. Here is a person who is working using the marketing industry. She wants to ask how can learning programming help for his or her real life?

I think, maybe, this question, we should ask the RailsGirls attendee, right here. Do any RailsGirls want to answer this question? Any RailsGirls? Oops. I think Linda has a lot of experience about this.

Linda: Let me see, marketing people, they run email campaigns. Maybe you can do a dashboard that showcases the analytics of your email campaigns, and that communicates better to your boss how important these things are.

Maybe you need to order a new campaign site and you have a programmer and the programmer says, “This is impossible. You can't do this,” so forth. Then you're like, “Yeah, bullshit. You can do this.”


Linda: Stuff like that. There's a lot of really tangible and real things that you can do in your industry. Any other brainstorming? I have never worked as a marketer.

Audrey: I'm going to talk a little bit more philosophically. Marketing is about getting message across to another person such that they may wish to exchange something that they have, with what you have so that you both become better. This is the fundamental of marketing.

Traditionally there are three kinds of exchanges or marketing behavior that we are used to. One is that this in-group, like maybe we’re in a family or maybe we’re in a “community” that has an in-group and an out-group.

Members in the family, or in such in-groups, the share everything, they exchange everything with everything, but they don't share with outsiders like 非我族類 (“aliens”) or something. This is one kind of exchange.

The second kind of exchange is what we see in a government or in a hierarchy where we only exchange with the upper ladder or the downward ladder. Like, I only report to my manager, my manager reports to their manager, and so on, so that the exchange of information is entirely hierarchical.

The third one is that we exchange with whoever with the cash, who has the money. We offer our service or our goods to people who have money, so we use that money to exchange with someone else, to other marketers who sells us things. We basically exchange through currency.

These are the three dominant exchange models in the world.

But by participating — as a marketer — into open source, like the Ruby community, you're going to learn the fourth exchange model in the world. That is, you freely exchange with anyone in the world for whatever purpose whatsoever.

This is an extremely revolutionary idea: I don’t care about whether you're in the same ethnic group as me, I don't care whether you’re Taiwanese or not. I don't care whether you’re my boss or my manager, and I don’t care whether you have the cash. I'm going to offer my service and my generosity to you.

This kind of marketing, as we proved, like Linda’s Kickstarter campaign, reaches more people in shorter time more efficiently than any of those three legacy, old exchange models. That's going to be the trend of the 21st century. By participating in an open source community, you're going to see firsthand how this works, and how to make it work for you in real time.


Matz: I used to work as the professional programmer, I still am. But I work for the company and I order to develop software in the team. In that time the many things out of control me, so the boss decides something, that you have use this tool, you have to use this language or something like that. But it's bullshit.


Matz: Now I'm working on open source software, mostly because it enhances my control. I can decide by myself what project I work on and I can decide which technology I use. I can decide what I do today in a certain degree much better than I used to. I think one of the joys from programming is the having power, and having control. Of course, the power comes with responsibility.

Hazel: Thank you. Well, but here is a caution about the female programming popularity. If the female programmer community is getting bigger and bigger, do they have any influence to the marketing of the programming industry?

Linda: I was just writing a report on this subject. The first professional programmers in the world were in the second World War, and there were a lot of females operating computers and calculating ballistic things, and so forth — Audrey might know more about the history of this — at that time they were doing a service to their country.

Then the next generation in the ‘60s was females who were operating computers or programming computers, because the men felt that it's a stupid manual labor thing. That's why women do it, the same way they operate telephones and so forth. But the women secretly realized that programming is really powerful, and they became better and better and better at it. It was like the Bell Labs.

I don't remember the name of the computer anymore, but they were working on this computer and the whole image of programming being male was really crafted in the ‘60s. Because the male wanted to get back the programming industry.

The requirements they used to get people into programming positions were crafted so that only young men would fit them, and very artificially done, this whole movement. Before that it was a women's profession, for the better or the worse, because it wasn't valued by the society at the time. But maybe Audrey knows more about that.

Audrey: Actually, Linda said pretty much everything there is to say about the history in United States. I think the marketing of teaching and applying and doing programming, it's going to be very much distributed.

Because 20 years ago, even, we have this idea of a larval stage — 結蛹期. It’s part of the hacker dictionary, the Jargon files. It says, basically, that to become a professional programmer, a hacker, you have to spend three or four years of your time addicted to your computer, totally breaking your sleep patterns and working 20 hour shifts. Then you will, at one point, reach enlightenment. This is a lot like Zen Buddhism.


Audrey: Once you reach that point, once you reach the point of 零的轉移、巫術的權勢 (the point of Zero transference — the power of wizardry), basically you become a wizard. Once you become a wizard, the distinctions — like Matz said, of gender, of age, of nationality, of ethnicity — they just disappear. It's like the scene in The Matrix, where Neo sees everything as green digits.


Audrey: Once you hit that stage, nothing else really affects your objective judgment. That’s also a very Zen Buddhism thing. But I think that’s partially a myth, because it was so difficult to learn about programming without the Internet community at that time.

Now with RailsGirls and communities like that, we have a slope. You can very comfortably stay on any point in the slope, with a lot of people in the same ladder to support each other, and you don't need to spend two or three years of your life.

This way, you can spread it through five years or six years — you can even sleep eight hours a day without falling back. I think that's going to change the market very much, because then instead of just amateurs and professionals, we're going to have market segments for every point in the ladder, and that's going to make the market and the community much larger.


Hazel: Next question: What is your first entry into programming?

Charles: I don't really know when, like when I was six or seven and I learned how I could use the computer, I was immediately trying to figure out how to make it do more things than it did right then.

But over the years the things that have really inspired me to keep going is, first of all, the power rush is nice. But being able to make other people happy, make their lives easier by writing software that helps them.

I work on JRuby as a passion, because I hear stories from people that use our software, and love it, and they're happy and their lives are better as a result. That's what's really kept me going, and inspired me to continue to be a programmer, and try to get everybody that know to be a programmer as well. Because it just brings so much to other people's lives as well.

[speakers pass the mic around]

Audrey: This is like passing the baton, right?

Audrey: I remember my first entry into programming was when I was seven, and I got this really old book. Matz actually just told me, in private, that he had this really small town library where there is a book about the Ada programming language.

There weren't many programming language books, and was an Ada programming reference. He just read it from cover to cover. Very unfortunately for me, my book was about GW-Basic.

[laughter and applause]

Audrey: Yeah, if it had been Ada, maybe I would be a better programmer. But in any case, I read it from cover to cover. But I didn’t have any computers or I haven't seen any computers at that time.

What I did was I took a piece of paper, I started writing on it, drawing keyboards. I started pressing the paper. I started pressing the keys and writing the alphabets that would come after the command line. Then I still remember the touch of my fingers on the face when I type 10, space, RANDOMIZE TIMER, which is what you do is GW-Basic. I have this etched in my muscle memory before I met my first computer.

But that was a defining point, because it shows that computing is not about computers, it's about a certain way of thinking. It's about a certain way — if you organize your thought in a certain way, it yields predictable results, and it yields something that you can show to other people, so they can replicate your results. This is actually the scientific paradigm. This is like what a person without any scientific equipment whatsoever, they could just figure out, by an old GW-Basic book, the scientific method for themselves. For me, that's was the defining point.

Matz: Well, I had a similar experience. I was a little bit older when I met computer, I was 15. Soon after that, the computer runs BASIC, a reduced set of it, the language was very limited. It does only 4k memory or something. The BASIC was very strict, it has only one character variable, that means that you can have only 26 variables. That's kind of frustrating.

In the bookstore, I found a book about Pascal, so I read through the book of Pascal from cover to cover. Then I realized that there are several, there are many programming languages out there. Computer programming languages are different from each other, so someone must have created those programming languages with some intention.

At that time, somehow, I got an idea, that someone created the programming language for their purpose, so why not me?

Since then, since that idea struck my brain, I became very, very interested in programming languages. No matter what kind of program — I don’t care, I care about the programming language.

So my other friends wanted to program to, say, create games or make money or something, but I don’t care. I care about the medium, not the purpose. I read through the Ada book, Pascal books, Modula, Lisp, some other programming languages.

But I didn't have a computer to create a programming language. I had no knowledge about the compiler or interpreter, so I took my notebook, and I wrote down the program in my idea of programming language. You don't need programming skill to design a programming language.

Unfortunately, I lost that notebook, it’s really shame. I don’t remember anything. I believe that was something in between Pascal and LISP.

Actually, I didn't have friends who knew computers, in my high school age. I went to the university. I met some people who loved programming. At that time, I found that very few people care about programming languages. Then, I studied about computer science. I learned how to write compilers. Then, gradually, I created Ruby. Gradually, it took over the world.


Matz: The idea of a programming language was a very enlightening idea for me, at my high school age.

Linda: [laughs] I told about the Al Gore story already. [laughs] Defining moment. More recently, I went to the bookstore. Before I made the Ruby thing, I tried to look for books that would explain for kids how computers work.

I would find tons of books that talked about astronomy, like how to be an astronomer or how does a combustion engine work, aimed at [laughs] kids but none that would explain how computers work. That was an "Aha" moment for me, that this body of work or this material around software engineering needs to exist, and maybe I need to be the person who does it. I loved Audrey’s paper computer example.

One of the things I want to do is do a little origami paper computer that the kids can assemble themselves, put in the little CPU, and have a very tangible feeling about having a real computer, and their first paper computer. As you said, computing is not about the actual hardware or anything like that, but that experience of owning it.

Charles: Stay passionate about programming is to look at things that you would deal with every day and find a way to solve it through programming. Raising kids, there's a million and one things that you could use a program to help you manage it, sleep schedules, meals, or whatever. All sorts of things that you could do.


Charles: The other thing is to remember that, of all of the abilities that we have as humans, being able to program, being able to design programs, has probably some of the fewest demands on you. It really just needs time and a little bit of energy, which, of course, when you're raising kids, those are the two things you really don't have any more.

But as long as you're able to find just a few minutes in the day to keep moving forward, build things around your life, around your passions, kids and stuff in the house, if it gets to that point. You'll be able to keep going. You'll be able to keep going.

I can't imagine programming not being part of my life anymore. Even through the most difficult times. I've had to take some breaks sometimes, I've had to go away. I've gotten burned out on the projects that I'm working on, upset by things that people say to me or say about my programs, about my projects. But I've always come back.

I don't know anybody who has been a programmer that wasn't a programmer forever, in some way. It changes you, and I think it stays with you for the rest of your life.

Linda: A practical example, my friend made a little Arduino clock that connects to her Fitbit, and it shows like a little screen, it shows how many steps away from home she is for her little kids, all the time. Projects like that maybe, it might be helpful in just kindling that passion.

I want to quote our practical German friends. I've talked to a lot of people about their motivations in taking part in RailsGirls and so forth all around the world. The German girls, one of them approaches me and said that “Programming is the most flexible work you have. It's well paid, you can do it at home with the kids. You can do it in the evening, you can do it in the morning.” It allows them to be very self-sufficient, and that's why they want to change careers.


Matz: The ladies are very easy to distract away from the programming, or even careers. Mostly because the social pressure, and the psychological “mind-set” or something. I declare it's OK to have passion on programming, on your career. Even you have to care about your family, your children, but you can still have passion on programming or your career.

You can come back someday. That kind of passion can motivate you. That kind of passion could be an engine to drive your life forward.

Audrey: As a personal anecdote, actually my brother has been teaching my father programming, for a while now, for a few months, and my father is in his 60s. He has a lot of students to teach, a lot of daily routines, three dogs, parents and everything.

I think the most important thing was putting your ideas somewhere that other people can see and improve on, and Ruby is a very quick way to do that of course. As long as you have a GitHub account you can just push something there, or even just as a quest you don't have to create a repository.

This is so people could start working on a code and giving you ideas, and suggestions, and that. Even if GitHub seems very hard — actually for my dad it is — you can use other tools like Hackpad, or even like Google Doc, or Google Spreadsheet, or EherCalc, or something like that.

Any online spreadsheet, or document, or any online drawing tool. You can capture your ideas in a place where everyone can see and comment on. It's actually the first step to programming. I mean it in a social way as well, and not in a coding way. To go back to the proper question. I think for someone who's time is fragmented or limited, one way is to watch or participate. One of those ongoing projects that require some input from the crowd does not require your full-time dedication. I'm going to have an advertisement for g0v.

In g0v we have a project that’s going at the moment, where we took all the grids of the reports of the spreadsheet of people's donations to their political campaigns. It was locked away in PDF, and it's only allowed to be printed with water mark, and they publish online, and you have to pay for the copying fees. You can only take two pages, or 100 pages out at a time, it was very archaic, and it is because they don't have a budget to do it.

What we did was we asked people to take the copied papers out, and we scanned them, and upload them on DropBox, or on Google Drive. You don't need to be very technical to do that, and then algorithms split them into individual grids.

Then you can visit the site to see just one grid cell. It's like a Captcha, or a game, where you just see a picture and guess — maybe a name, or maybe a number and just type in a name or a number. With this crowd-source way we have 300,000 cells identified and counting. People visit and improve the code such that the donations are now transparent, and it becomes part of the communal property.

This motivates a lot of people that have no idea what programming is, to start helping us writing a better guideline. Like there’s a person who has no experience designing a web page, that just feel very strongly about the cause. They learn about how to do Google sites, or do a basic HTML programming, so that they could put their beautiful icons to the standard operating procedure for those things.

This is about putting something into where people can see, and to contribute on. Even though you only have like five minutes, or even just 15 seconds a day, you can feel that you're part of the community, and you get to know people, who once you have a little bit more time, would take you further along the path.

Categories: Offsite Blogs