[Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Christopher Tauss
Hello Haskell Community - I am a professional programmer with 11 years experience, yet I just do not seem to be able to get the hang of even simple things in Haskell. I am trying to write a function that takes a list and returns the last n elements. There may be a function which I can just call

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Ivan Lazar Miljenovic
On 18 September 2010 17:51, Christopher Tauss wrote: > Hello Haskell Community - > > I am a professional programmer with 11 years experience, yet I just do not > seem to be able to get the hang of even simple things in Haskell.  I am > trying to write a function that takes a list and returns the l

[Haskell-cafe] Re: Unified Haskell login

2010-09-18 Thread Maciej Piechotka
On Fri, 2010-09-17 at 08:47 +0200, Michael Snoyman wrote: > Hi cafe, > > Let me preface this by stating that this is purposely a half-baked > idea, a straw man if you will. I'd like to hear what the community > thinks about this. > > I mentioned yesterday that I was planning on building haskeller

[Haskell-cafe] haltavista - look for functions by example

2010-09-18 Thread Paul Brauner
Hello, I just hacked together something I've been talking about a while ago on that mailing list. It's a program that looks for functions given a set of input/outputs. Example session 1: brau...@worf:~$ haltavista 2 2 4 Prelude (*) Prelude (+) Prelude (^) Example session 2 (re

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread David Terei
Here is a more manual way to do it, hopefully this shows the approach required. You don't need to store anything, just keep removing the head of the list until its of the size you want. n_lastn :: Int -> [a] -> [a] n_lastn n xs = let len = length xs - n drp = if len < 0 then 0 else len

Re: [Haskell-cafe] Re: Re: Re: Full strict functor by abusing Haskell exceptions

2010-09-18 Thread Sjoerd Visscher
On Sep 17, 2010, at 10:39 PM, Ben Franksen wrote: > What I actually wanted was a mathematical definition, though. Here's a definition of pointed objects: http://ncatlab.org/nlab/show/pointed+object -- Sjoerd Visscher sjo...@w3future.com ___ Haskell-

Re: [Haskell-cafe] translating bidirectional fundeps to TFs

2010-09-18 Thread Gábor Lehel
On Fri, Sep 17, 2010 at 10:19 PM, Dan Doel wrote: > On Friday 17 September 2010 4:04:26 pm Gábor Lehel wrote: >> What I would *want* to write is this: >> >> class (Mutable (Thawed a), Frozen (Thawed a) ~ a) => Immutable a where >>     type Thawed a :: * >>     thaw :: a -> Thawed a >> >> class (Im

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Nils Schweinsberg
Am 18.09.2010 09:51, schrieb Christopher Tauss: I am trying to write a function that takes a list and returns the last n elements. last_n n = fst . foldr step ([], n) where step _ (xs, 0) = (xs, 0) step x (xs, n) = (x:xs, n-1) ___ Haskell-Ca

[Haskell-cafe] Uniting graphics libraries

2010-09-18 Thread Tillmann Vogt
Hi, I have nearly finished writing a Collada-output library to make 3d animation files. Before doing this I have looked at two libraries on hackage that parse Collada to display it. For my library I have copied the types from gpipe-collada and extended them. Now I am thinking that it would b

Re: [Haskell-cafe] Uniting graphics libraries

2010-09-18 Thread Vo Minh Thu
2010/9/18 Tillmann Vogt : >  Hi, > > I have nearly finished writing a Collada-output library to make 3d animation > files. Before doing this I have looked at two libraries on hackage that > parse Collada to display it. For my library I have copied the types from > gpipe-collada and extended them. N

Re: [Haskell-cafe] Uniting graphics libraries

2010-09-18 Thread Tillmann Vogt
Am 18.09.2010 15:14, schrieb Vo Minh Thu: Hi, This is a great goal! I've also been thinking in solidifying all things 3D on hackage lately and forming a game and graphics strike team. (The idea is that even if you're not interested in games, there are still a lot of common things.) Now it seems

Re: [Haskell-cafe] Uniting graphics libraries

2010-09-18 Thread Vo Minh Thu
2010/9/18 Tillmann Vogt : >  Am 18.09.2010 15:14, schrieb Vo Minh Thu: >> >> Hi, >> This is a great goal! I've also been thinking in solidifying all >> things 3D on hackage lately and forming a game and graphics strike >> team. (The idea is that even if you're not interested in games, there >> are

Re: [Haskell-cafe] Uniting graphics libraries

2010-09-18 Thread Tillmann Vogt
Am 18.09.2010 16:16, schrieb Vo Minh Thu: Ok. I'll learn more about Collada then. Is your code already available somewhere? I will upload it in a few days on hackage. It is not finished yet. Still, Collada seems to be on a far end of the spectrum of what could be unified. I mean, say your a

Re: [Haskell-cafe] Web development work

2010-09-18 Thread Michael Snoyman
Cool, an API sounds great. I favor a RESTful API, so most likely it would simply be JSON served via the same URL as the main page; jus set the Accept header appropriately. Does that sound good enough? Michael On Fri, Sep 17, 2010 at 5:21 PM, Jeremy Shaw wrote: > I have been meaning to add a jobs

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Jake McArthur
On 09/18/2010 02:51 AM, Christopher Tauss wrote: I am trying to write a function that takes a list and returns the last n elements. This may just be for the sake of learning, in which case this is fine, but usually, needing to do this would be a sign that you are using lists improperly (sinc

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Christopher Tauss
Thanks you Ivan and David for clarifying this. Best Regards, Chris On Sat, Sep 18, 2010 at 3:55 AM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: > On 18 September 2010 17:51, Christopher Tauss wrote: > > Hello Haskell Community - > > > > I am a professional programmer with 11 yea

[Haskell-cafe] Re: Ultra-newbie Question

2010-09-18 Thread Maciej Piechotka
On Sat, 2010-09-18 at 03:51 -0400, Christopher Tauss wrote: > Hello Haskell Community - > > I am a professional programmer with 11 years experience, yet I just do > not seem to be able to get the hang of even simple things in Haskell. > I am trying to write a function that takes a list and return

Re: [Haskell-cafe] ANN: happstack-auth-0.2

2010-09-18 Thread Nils Schweinsberg
Am 17.09.2010 22:06, schrieb Nils Schweinsberg: [1] http://hackage.haskell.org/package/happstack-auth Hackage fails to build this package: http://hackage.haskell.org/packages/archive/happstack-auth/0.2/logs/failure/ghc-6.12 However, "Crypto == 4.*" should be on hackage: http://hackage.haskel

Re: [Haskell-cafe] ANN: happstack-auth-0.2

2010-09-18 Thread Ross Paterson
On Sat, Sep 18, 2010 at 08:19:33PM +0200, Nils Schweinsberg wrote: > Am 17.09.2010 22:06, schrieb Nils Schweinsberg: > >[1] http://hackage.haskell.org/package/happstack-auth > > Hackage fails to build this package: > > http://hackage.haskell.org/packages/archive/happstack-auth/0.2/logs/failure/gh

Re: [Haskell-cafe] ANN: happstack-auth-0.2

2010-09-18 Thread Thomas DuBuisson
Why are you using Crypto? I'm hoping to make "Crypto" as we know it obsolete. To that end, I've been working on a unified interface (crypto-api) and after the algorithms packages catch up I planned to make a meta package "crypto-algs". Cheers, Thomas On Sat, Sep 18, 2010 at 11:19 AM, Nils Schwe

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Daniel Fischer
On Saturday 18 September 2010 19:44:38, Jake McArthur wrote: > On 09/18/2010 02:51 AM, Christopher Tauss wrote: > > I am trying to write a function that takes a list and returns the last > > n elements. > > This may just be for the sake of learning, in which case this is fine, > but usually, needin

Re: [Haskell-cafe] translating bidirectional fundeps to TFs

2010-09-18 Thread Dan Doel
On Saturday 18 September 2010 8:27:45 am Gábor Lehel wrote: > Hmm. I had a similar thought, but dismissed it because I was under the > impression that you needed to use all the parameters of the class as > parameters of its associated types. But apparently that was mistaken > -- or, at least, your

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Luke Palmer
I think this is O(n) time, O(1) space (!). lastk :: Int -> [a] -> [a] lastk k xs = last $ zipWith const (properTails xs) (drop k xs) where properTails = tail . tails Luke On Sat, Sep 18, 2010 at 1:51 PM, Daniel Fischer wrote: > On Saturday 18 September 2010 19:44:38, Jake McArthur wrote: >>

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Daniel Fischer
On Saturday 18 September 2010 22:42:57, Luke Palmer wrote: > I think this is O(n) time, O(1) space (!). > > lastk :: Int -> [a] -> [a] > lastk k xs = last $ zipWith const (properTails xs) (drop k xs) >     where properTails = tail . tails > > Luke No, it's O(k) too. You zip [[x_n, x_{n+1}, ... ],

Re: [Haskell-cafe] Ultra-newbie Question

2010-09-18 Thread Alexander Solla
On Sep 18, 2010, at 12:51 AM, Christopher Tauss wrote: I am a professional programmer with 11 years experience, yet I just do not seem to be able to get the hang of even simple things in Haskell. I am trying to write a function that takes a list and returns the last n elements. Note

Re: [Haskell-cafe] Web development work

2010-09-18 Thread Jeremy Shaw
A RESTful API with JSON results sounds perfect. I will be surprised if the API useful for 3rd party sites happens to map on to the URL structure used by the main site. But if that works, all the better :) Of course, if your site which is creating the JSON is written in Haskell, and my site

Re: [Haskell-cafe] Re: Re: Re: Full strict functor by abusing Haskell exceptions

2010-09-18 Thread wren ng thornton
On 9/18/10 8:00 AM, Sjoerd Visscher wrote: On Sep 17, 2010, at 10:39 PM, Ben Franksen wrote: What I actually wanted was a mathematical definition, though. Here's a definition of pointed objects: http://ncatlab.org/nlab/show/pointed+object pointed objects, pointed sets/groups/topospaces, poi

[Haskell-cafe] Re: "malicious" JS on haskell site

2010-09-18 Thread Keith Sheppard
Popup advertising is still being hosted on haskell.org. What is the right way to deal with this? Is there a person or process to fix this? Deleting some nedstatbasic javascript at the bottom should fix the problem. I'm sorry for sending this to such a large list but I don't know who the is the righ

Re: [Haskell-cafe] Re: Re: Re: Full strict functor by abusing Haskell exceptions

2010-09-18 Thread Dan Doel
On Saturday 18 September 2010 6:03:39 pm wren ng thornton wrote: > pointed objects, pointed sets/groups/topospaces, pointed categories, > pointed functors, etc aren't all the same though. The definition of pointed objects could be massaged to yield pointed functors, though. Instead of a categor

Re: [Haskell-cafe] Web development work

2010-09-18 Thread Michael Snoyman
On Sat, Sep 18, 2010 at 11:47 PM, Jeremy Shaw wrote: > A RESTful API with JSON results sounds perfect. I will be surprised if the > API useful for 3rd party sites happens to map on to the URL structure used > by the main site. But if that works, all the better :) > > Of course, if your site which

Re: [Haskell-cafe] Re: Ultra-newbie Question

2010-09-18 Thread Gregory Crosswhite
Translation: Look at Data.Sequence sometime. On 9/18/10 11:15 AM, Maciej Piechotka wrote: On Sat, 2010-09-18 at 03:51 -0400, Christopher Tauss wrote: Hello Haskell Community - I am a professional programmer with 11 years experience, yet I just do not seem to be able to get the hang of even s

Re: [Haskell-cafe] Re: Ultra-newbie Question

2010-09-18 Thread Gregory Crosswhite
Translation: Look at Data.Sequence sometime. On 9/18/10 11:15 AM, Maciej Piechotka wrote: On Sat, 2010-09-18 at 03:51 -0400, Christopher Tauss wrote: Hello Haskell Community - I am a professional programmer with 11 years experience, yet I just do not seem to be able to get the hang of even s