Visit the LQ Articles and Editorials section
Go Back > Blogs > Bits and Pixels
User Name


Concerning free software, programming, and whatever else I find interesting. Also the blog for my Web site,

C++ had lambda functions!

Posted 01-31-2013 at 02:21 AM by hydraMax (Bits and Pixels)

I'm doing a CS class which forces me to use C++. I was not very excited about this. However, I have recently be greatly encouraged by the discovery that C++ does, in fact, have lambda functions (or, more properly, anonymous functions) at least in the C++11 standard:

Basically, the big deal here is that I can construct new functions /inside/ of other functions, and even capture variables from the context. This,...
Posted in Uncategorized
Views 565 Comments 0 hydraMax is offline

Quick and dirty plotting with Haskell: Supplement

Posted 01-15-2013 at 12:54 AM by hydraMax (Bits and Pixels)

I just wanted to add a brief note to my previous post: It is also quite simple to do a plot with multiple functions. The following code gives the graph seen in the attached PNG:

h> import Graphics.Gnuplot.Simple
h> let f x = 3 - 2*x + 4*x**2
h> let g x = 8*x - 2
h> let h a x = g a * (x - a) + f a
h> plotFuncs [] (linearScale 1000 (-10,10)) [f, g, h (-5)]
f(x) is a function, g(x) is the derivative of f(x), and...
Attached Images
File Type: png plotFuncs.png (49.5 KB, 4 views)
Posted in Uncategorized
Views 590 Comments 0 hydraMax is offline

Installed Nix

Posted 01-09-2013 at 02:49 PM by hydraMax (Bits and Pixels)
Tags nix

I recently installed the Nix package manager on my system:

Nix is an intriguing idea: a purely functional and deterministic package management system. Nix allows you to install, upgrade, and remove packages on your system without ever having to worry about breaking the dependencies of other packages already installed on your system. This is impossible, by design. Likewise, after installing new packages, you are free to roll back those changes...
Posted in Uncategorized
Views 499 Comments 0 hydraMax is offline

haskell: get lines and handle end of file

Posted 01-01-2013 at 03:23 AM by hydraMax (Bits and Pixels)
Updated 01-01-2013 at 03:27 AM by hydraMax
Tags haskell

I thought I'd post this convenience function, since I didn't see an obvious one in base:

import Prelude hiding (catch)
import Control.Exception
import System.IO.Error hiding (catch)

readl f = catch (getLine >>= return . Just)
                (\e -> if (isEOFErrorType . ioeGetErrorType) e
                         then return Nothing
                         else ioError e)
          >>= \a -> case a of
Posted in Uncategorized
Views 940 Comments 0 hydraMax is offline


All times are GMT -5. The time now is 12:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration