Re: [Haskell-cafe] function arithmetic?

2013-09-01 Thread Christopher Howard
On 08/31/2013 09:27 PM, Charlie Paul wrote: I believe that this is what you want: http://www.haskell.org/haskellwiki/Num_instance_for_functions On Sat, Aug 31, 2013 at 10:01 PM, Christopher Howard christopher.how...@frigidcode.com wrote: The author seemed to be subtly mocking the idea

[Haskell-cafe] function arithmetic?

2013-08-31 Thread Christopher Howard
Hi. I was just curious about something. In one of my math textbooks I see expressions like this f + g or (f + g)(a) where f and g are functions. What is meant is f(a) + g(a) Is there a way in Haskell you can make use of syntax like that (i.e., expressions like f + g and f * g to create a

[Haskell-cafe] continuations and monads

2013-08-17 Thread Christopher Howard
Q: Are the continuations in Scheme related to the monads from Haskell? If so, could someone elaborate on that? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] memoization

2013-07-22 Thread Christopher Howard
When I previously asked about memoization, I got the impression that memoization is not something that just happens magically in Haskell. Yet, on a Haskell wiki page about Memoization http://www.haskell.org/haskellwiki/Memoization#Memoization_with_recursion, an example given is memoized_fib

Re: [Haskell-cafe] memoization

2013-07-22 Thread Christopher Howard
On 07/21/2013 11:19 PM, KC wrote: Have you tried the compiler? No. Would that work differently some how? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] memoization

2013-07-22 Thread Christopher Howard
On 07/21/2013 11:52 PM, Chris Wong wrote: [.. snipped ..] A binding is memoized if, ignoring everything after the equals sign, it looks like a constant. In other words, these are memoized: x = 2 Just x = blah (x, y) = blah f = \x - x + 1 -- f = ... and these

Re: [Haskell-cafe] memoization

2013-07-22 Thread Christopher Howard
On 07/22/2013 06:16 AM, Andreas Abel wrote: On 22.07.2013 09:52, Chris Wong wrote: True, but the essential thing to be memoized is not memoized_fib, which is a function, but the subexpression map fib [0..] which is an infinite list, i.e., a value. The rule must be like in let x = e

Re: [Haskell-cafe] memoization

2013-07-22 Thread Christopher Howard
On 07/22/2013 03:41 PM, David Thomas wrote: I, for one, would love to have a compiler do (a) based on (b), my specification of (c), and the ability to pin particular things... The reason it is a big deal to me is it sometimes the more natural-looking (read, declarative) way of writing a

[Haskell-cafe] partially indeterminate?

2013-07-15 Thread Christopher Howard
Hi. For learning, I was doing the phone words problem, where a function translates the digits of a phone number into all possible words. I am trying to connect this idea to the idea of list comprehensions / list monads (sort of the same thing, yes?) I know it is easy to do this: w = do two - ABC

[Haskell-cafe] Roman Numeral Problem

2013-06-24 Thread Christopher Howard
Hi. I am working on some practice programming problems, and one is the Roman numeral problem: write a program that converts Roman numerals into their (arabic) numeral equivalent. I imagine I could hack something together, but I was trying to think about the problem a bit more deeply. I don't know

[Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Christopher Howard
I'm working through some beginner-level keyboard problems I found at users.csc.calpoly.edu. One problem is the Saddle Points problem: quote: Write a program to search for the saddle points in a 5 by 5 array of integers. A saddle point is a cell whose value is greater than or equal to any

Re: [Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Christopher Howard
On 06/15/2013 04:39 PM, Tommy Thorn wrote: There's not enough context to answer the specific question, but lazy evaluation isn't magic and the answer is probably no. Tommy Perhaps to simplify the question somewhat with a simpler example. Suppose you have code: let f x = if (x

Re: [Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Christopher Howard
On 06/15/2013 05:02 PM, Christopher Howard wrote: On 06/15/2013 04:39 PM, Tommy Thorn wrote: Perhaps to simplify the question somewhat with a simpler example. Suppose you have code: let f x = if (x 4) then f 0 else (sin x + 2 * cos x) : f (x + 1) After calculating

Re: [Haskell-cafe] Simplest way to learn FRP through use

2013-06-01 Thread Christopher Howard
On 05/31/2013 07:47 PM, Tikhon Jelvis wrote: My favorite mini app is John Conway's game of life. I implemented a version with reactive banana and found it perfect for learning the ideas. I have a simple version of the code up on GitHub if you ever want a nice example to read. I tried to make

[Haskell-cafe] Simplest way to learn FRP through use

2013-05-31 Thread Christopher Howard
I want to learn FRP but am having trouble wading through all the theory about how FRP is implemented and how it /could/ be used for various applications. What is the simplest, easiest-to-learn module or system allowing you to quickly make something interesting (if not very impressive) in an FRP

Re: [Haskell-cafe] rip in the class-abstraction continuum

2013-05-20 Thread Christopher Howard
On 05/19/2013 10:10 PM, Tillmann Rendel wrote: This is not easily possible. If you could just put the constraint into the instance, there would be a problem when youc all toXy in a polymorphic context, where a is not known. Example: class XyConv a where toXy :: a b - [Xy b]

[Haskell-cafe] rip in the class-abstraction continuum

2013-05-19 Thread Christopher Howard
Hi. I won't pretend to be an advanced Haskell programmer. However, I have a strong interest in abstraction, and I have been playing around with programming as abstractly as possible. Naturally, I find classes to be quite attractive and useful. However, something is bothering me. Lately I keep

[Haskell-cafe] fromIntegral not enough?

2013-05-13 Thread Christopher Howard
This is probably a haskell-beginners sort of question, but I usually get about 4x as many responses from cafe, about 10x as fast. I have code like so: code: data Xy a = Xy a a class Coord2 a where coords2 :: Fractional b = a b - Xy b data CircAppr a b = CircAppr a b b -- number of

Re: [Haskell-cafe] fromIntegral not enough?

2013-05-13 Thread Christopher Howard
On 05/13/2013 02:53 PM, Tom Ellis wrote: On Mon, May 13, 2013 at 11:43:41PM +0100, Tom Ellis wrote: You probably want let angles = map ((* dAng) . fromInteger) [0..divns] in ... instead. Ah, that works. Thanks all. -- frigidcode.com signature.asc Description: OpenPGP

[Haskell-cafe] Flip around type parameters?

2013-05-09 Thread Christopher Howard
Hi. Does Haskell allow you to flip around type parameters somehow? I was playing around with toy code (still learning the fundamentals) and I came up with a class like this: code: class Rotatable2D a where rotate :: (Num b) = (a b) - b - (a b) It was easy to make an

[Haskell-cafe] GPGPU

2013-05-04 Thread Christopher Howard
Has anybody on the list been playing around with OpenCL at all? I'm just starting to look into it - need to get a newer Radeon card, I think - but I'm strongly interested in GPGPU programming. -- frigidcode.com signature.asc Description: OpenPGP digital signature

[Haskell-cafe] Cabal / cabal-install: special installation

2013-05-02 Thread Christopher Howard
Hi. This question dovetails off my previous thread. I described how I got ghc-7.6.3 installed from source onto an old RHEL5 machine. Naturally, I want to get cabal-install installed and start building great Hackage software. However, I have this quirk: I installed GHC to a special directory using

Re: [Haskell-cafe] Looking for portable Haskell or Haskell like language

2013-05-01 Thread Christopher Howard
On 05/01/2013 12:21 AM, Gabor Greif wrote: Am 27. April 2013 um 07:21 schrieb Christopher Howard christopher.how...@frigidcode.com: I can feel your pain... Here is a blog post I have written some time ago http://heisenbug.blogspot.de/2011/09/ghc-704-on-centos.html about how to bridge

[Haskell-cafe] ghc-7 -fPIC error

2013-04-29 Thread Christopher Howard
Hey guys, this probably isn't the official GHC mailing list, but I've been trying to build and install a new GHC on an old RHEL5 system, as mentioned in my previous Cafe thread. I was able to make some good headway: I installed a ghc-6.8 binary, and then used that to build ghc-6.10 source, and

Re: [Haskell-cafe] Looking for portable Haskell or Haskell like language

2013-04-27 Thread Christopher Howard
On 04/27/2013 08:36 AM, Jerzy Karczmarczuk wrote: Christopher Howard: Is the portability which worries you, or the age of your system? Actually getting a successful build and installation would be great. Also, there are multiple systems I work with, both of which have ancient software

[Haskell-cafe] Looking for portable Haskell or Haskell like language

2013-04-26 Thread Christopher Howard
Hi. I've got this work situation where I've got to do all my work on /ancient/ RHEL5 systems, with funky software configurations, and no root privileges. I wanted to install GHC in my local account, but the gnu libc version is so old (2.5!) that I can't even get the binary packages to install.

[Haskell-cafe] Monad fold

2013-04-16 Thread Christopher Howard
So, I'm doing something like this foldl (=) someA list :: Monad m = m a where list :: Monad m = [a - m a], someA :: Monad m = m a Is there a more concise way to write this? I don't think foldM is what I want -- or is it? -- frigidcode.com signature.asc Description: OpenPGP digital

[Haskell-cafe] Fwd: [Haskell-beginners] Monad instances and type synonyms

2013-04-13 Thread Christopher Howard
I asked this question in Haskell-beginners, but I haven't heard anything yet, so I'm forwarding to Cafe. Original Message Subject: [Haskell-beginners] Monad instances and type synonyms Date: Sat, 13 Apr 2013 17:03:57 -0800 From: Christopher Howard christopher.how

Re: [Haskell-cafe] exp implementation

2013-04-11 Thread Christopher Howard
On 04/11/2013 06:37 AM, Brandon Allbery wrote: On Thu, Apr 11, 2013 at 1:38 AM, Christopher Howard christopher.how...@frigidcode.com mailto:christopher.how...@frigidcode.com wrote: Hi. For my own learning, I wanted to see how the exp function is implemented in GHC. I have GHC 7.4.1

Re: [Haskell-cafe] exp implementation

2013-04-11 Thread Christopher Howard
On 04/11/2013 07:12 AM, Christopher Howard wrote: On 04/11/2013 06:37 AM, Brandon Allbery wrote: I traced it down some more: I think it eventually goes into the compiler/nativeGen section where it is translated into the platform's native version of the function. On my platform, I think

[Haskell-cafe] exp implementation

2013-04-10 Thread Christopher Howard
Hi. For my own learning, I wanted to see how the exp function is implemented in GHC. I have GHC 7.4.1 source code open, but I'm having trouble figuring out which file the actual function definition is in. I see expFloat(F# x) = F# (expFloat# x) in libraries/base/GHC/Float.lhs. --

[Haskell-cafe] nice pattern from simple converging series

2013-03-28 Thread Christopher Howard
I made a nice little pattern from just a few lines of Haskell (mostly code comments) using gloss. It is very kindergarten in terms of mathematical art, but the idea was to illustrate that in a pretty short amount of time, and a small amount code, you could easily translate simple math concepts

[Haskell-cafe] translating recursively defined sequence

2013-03-04 Thread Christopher Howard
Hi. My Haskell is (sadly) getting a bit rusty. I was wondering what would be the most straightforward and easily followed procedure for translating a recursively defined sequence into a Haskell function. For example, this one from a homework assignment. quote: a_1 = 10 a_(k+1) = (1/5) *

Re: [Haskell-cafe] translating recursively defined sequence

2013-03-04 Thread Christopher Howard
On 03/04/2013 08:36 PM, Bob Ippolito wrote: I suppose it depends on your definition of straightforward but you can use the iterate function from Data.List to quickly define sequences like this. a = iterate (\x - (1/5) * (x**2)) 10 On Mon, Mar 4, 2013 at 9:19 PM, Christopher Howard

[Haskell-cafe] derivatives and integrals

2013-02-26 Thread Christopher Howard
Hi. The scope of this question is likely bigger that Haskell, but this seems like the right crowd to ask. I'm in Calc II right now, and I'm looking for a FOSS desktop application (I use Gnu/Linux) to replace the functionality of my TI-98 in finding derivatives and integrals. (It's very convenient

Re: [Haskell-cafe] Where is the convergence point between Category Theory and Haskell?

2013-01-13 Thread Christopher Howard
On 01/13/2013 03:15 AM, Alfredo Di Napoli wrote: Morning Cafe, I'm planning to do a series of write-ups about Category Theory, to publish them on the company's blog I'm currently employed. I'm not a CT expert, but since the best way to learn something is to explain it to others, I want to

[Haskell-cafe] ln, e

2013-01-05 Thread Christopher Howard
Hi. Are natural log and Euler's constant defined somewhere in base, or a convenience math module somewhere? I'm having trouble finding them with hayoo or system documentation. -- frigidcode.com signature.asc Description: OpenPGP digital signature

[Haskell-cafe] Proving programs

2013-01-01 Thread Christopher Howard
I'm working through a video lecture describing how to prove programs correct, by first translating the program into a control flow representation and then using propositional logic. In the control flow section, the speaker described how the program should be understood in terms of an input vector

Re: [Haskell-cafe] monoid pair of monoids?

2012-12-21 Thread Christopher Howard
On 12/20/2012 08:54 PM, Daniel Feltey wrote: You were only missing the restriction that both types a and b must be instances of Monoid in order to make Socket a b into an instance of Monoid. Dan Feltey Thank you for your help. An additional question, if I might: For the sake of elegance

[Haskell-cafe] Layer on a layer of record syntax in the type synonym?

2012-12-21 Thread Christopher Howard
Using a simple type I gave earlier from my monadic type question... code: data Socket3 a b c = Socket3 a b c deriving (Show) Is it possible somehow to layer on record syntax onto a synonym of the type? The idea would be something like this... code: type SpaceShip =

Re: [Haskell-cafe] Layer on a layer of record syntax in the type synonym?

2012-12-21 Thread Christopher Howard
On 12/21/2012 04:52 AM, Daniel Trstenjak wrote: Why having a Socket3 in the first place, what's the point of it? The idea was to have some generic structures (Sockets) which were already instanced into the Monoids-within-Monoids abstraction, yet could still be made concrete into anything

[Haskell-cafe] Categories (cont.)

2012-12-20 Thread Christopher Howard
I've perhaps been trying everyones patiences with my noobish CT questions, but if you'll bear with me a little longer: I happened to notice that there is in fact a Category class in Haskell base, in Control.Category: quote: class Category cat where A class for categories. id and (.)

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread Christopher Howard
On 12/20/2012 03:59 AM, wren ng thornton wrote: On 12/20/12 6:42 AM, Christopher Howard wrote: As mentioned in my other email (just posted) the kind mismatch is because categories are actually monoid-oids[1] not monoids. That is: class Monoid (a :: *) where mempty

[Haskell-cafe] monoid pair of monoids?

2012-12-20 Thread Christopher Howard
In my current pondering of the compose-able objects them, I was thinking it would be useful to have the follow abstractions: Monoids, which were themselves tuples of Monoids. The idea was something like so: code: import Data.Monoid instance Monoid (Socket2 a b) where mempty = Socket2

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Christopher Howard
On 12/17/2012 06:30 PM, Richard O'Keefe wrote: On 18/12/2012, at 3:45 PM, Christopher Howard wrote: It's basically the very old idea that an Abstract Data Type should be a nice algebra: things that look as though they ought to fit together should just work, and rearrangements of things

[Haskell-cafe] efficient data structure: column with repeating values

2012-12-18 Thread Christopher Howard
Is there some good data type out there that basically provides a simple table, but with optimization for repeating values on one column? Something like: Data Table a b ...where it assumes that 'a' values will usually be unique, while 'b' values will usually be repeated from a small set? (But not

Re: [Haskell-cafe] category design approach for inconvenient concepts

2012-12-18 Thread Christopher Howard
On 12/18/2012 08:02 PM, Gershom Bazerman wrote: On 12/17/12 9:45 PM, Christopher Howard wrote: I don't think you're describing a Category in the sense of the Haskell Category typeclass. But that's ok! Just because some things are categories and are nice doesn't mean that we can't have other

[Haskell-cafe] haskell-like scripting language

2012-12-17 Thread Christopher Howard
I gave Shelly a try. Pretty cool - using it for some of the scripts on my system. Has me wondering though: is anyone working on creating a actual Haskell-like scripting language and engine? Shelly is cool, as I said, but I imagine it would be more valuable to have another language that is

[Haskell-cafe] category design approach for inconvenient concepts

2012-12-17 Thread Christopher Howard
Recently I read this article I happened across, about the categorical design pattern: http://www.haskellforall.com/2012/08/the-category-design-pattern.html Barely understood it, of course, but it was a rather intriguing concept. So now I'm looking at all my programming problems trying to make

[Haskell-cafe] edge: compile testing

2012-12-14 Thread Christopher Howard
Hey guys, to teach myself Haskell I wrote a little arcade game called The Edge, built on gloss. It is in hackage under the package name edge. Are there a few kind souls who would be willing to compile it on their machines and let me know if there are any problems at the compiling level? In the

Re: [Haskell-cafe] edge: compile testing

2012-12-14 Thread Christopher Howard
On 12/14/2012 07:05 PM, Clark Gaebel wrote: Unacceptable argument type in foreign declaration Thanks for giving it a try. Could you send off a bug report to the OpenAL Haskell module maintainer? sven.pa...@aedion.de (I might offer to do it, but I tried to e-mail him once about a different issue

Re: [Haskell-cafe] containers license issue

2012-12-13 Thread Christopher Howard
On 12/13/2012 08:34 AM, Clint Adams wrote: On Wed, Dec 12, 2012 at 11:11:28PM -0800, Chris Smith wrote: That's true. However, haskell.org's fiscal sponsor receives pro bono legal services. I may have been conflating threads, though the response to what I assume was just a lawyer asking

Re: [Haskell-cafe] containers license issue

2012-12-13 Thread Christopher Howard
On 12/13/2012 05:54 PM, Richard O'Keefe wrote: On 14/12/2012, at 7:45 AM, Christopher Howard wrote: Intimately familiar with New Zealand law, are they? I couldn't say anything about that, specifically. However, SFLC has an international outreach. From 2011 SFLC news: quote: We

[Haskell-cafe] education or experience?

2012-12-08 Thread Christopher Howard
I'm at something of a crossroads, and I'm hoping to get a bit of free career advice. I really enjoy programming with Haskell (and a few other exotic languages), and was hoping I could eventually make a living in that sort of field. Not rich and famous, necessarily, just enough to get by

[Haskell-cafe] sequential logic

2012-12-05 Thread Christopher Howard
Hi. I was wondering what the various (and especially most simple) approaches one could take for working with (simulating or calculating) sequential logic in Haskell. By sequential logic, I mean like wikipedia describes, where a system is made up of logic gates, whose output is dependent not only