IRC Snippets

Submitted by metaperl on Sat, 03/19/2005 - 1:24pm.


[11:19] [Cale] update x n xs = take n xs ++ x : drop (n+1) xs

Submitted by metaperl on Sat, 03/19/2005 - 2:10pm.


[12:03] metaperl is there some syntax/function for taking a list of transformers and the initial value so that mothersPaternalGrandfather s = (Just s) `comb` mother `comb` father `comb` father can be wrtten as (Just s) [mother, father, father]
[12:04] integral metaperl: foldl ?
[12:04] metaperl hi integral
[12:04] *** swiert quit ( )
[12:04] integral hi metaperl
[12:04] metaperl by golly, I think you are right integral

Submitted by metaperl on Sat, 03/19/2005 - 2:11pm.

[12:08] metaperl there's no way to short-circuit a chain of monadic computations? what if you want all further function calls to abort if you get a Nothing value?
[12:09] Darius metaperl: With the Maybe monad, that's what happens.
[12:09] metaperl oh
[12:09] Philippa_ and you can always sling a MaybeT on top
[12:09] integral and you've got laziness too remember

Submitted by metaperl on Mon, 03/21/2005 - 12:52pm.

[shapr] compositional thinking, which is the ultimate goal in software engineering.
3/21/2005 10:48

Submitted by metaperl on Thu, 03/24/2005 - 10:12pm.

[19:27] [autrijus] is there a way to get argv[0] in ghc?
[19:27] [autrijus] other than using inline C :)
[19:32] *** SamB quit (Read error: 110 (Connection timed out))
[19:32] [autrijus] ok. including using inline C.
[19:32] [dons] getProgName ?
[19:32] * autrijus does not seem to see a way
[19:32] [autrijus] no, that strips off leading dirnames.
[19:33] [autrijus] so, not terribly useful.
[19:33] [dons] write your own getProgName
[19:33] [dons] getProgName :: IO String
[19:33] [dons] getProgName =
[19:33] [dons] alloca $ \ p_argc ->
[19:33] [dons] alloca $ \ p_argv -> do
[19:33] [dons] getProgArgv p_argc p_argv
[19:33] [dons] argv <- peek p_argv
[19:33] [dons] unpackProgName argv
[19:33] [dons] wheree you define a better unpackProgName
[19:33] [autrijus] getProgArgv?
[19:33] [dons] getProgName currently runs a local basename :: String -> Strin\
g
[19:34] [autrijus] getProgArgv is not shown in docs...
[19:34] [autrijus] IOBase?
[19:35] [dons] System.Environment
[19:35] [autrijus] foreign import ccall unsafe "getProgArgv"
[19:35] [autrijus] getProgArgv :: Ptr CInt -> Ptr (Ptr CString) -> IO ()
[19:35] [autrijus] only not re-exported.
[19:35] [autrijus] so I'll need to replicate here
[19:35] [dons] ah.
[19:35] [autrijus] ok, that works. thanks!
[19:35] [autrijus] dons++
[19:36] [dons] :)

Submitted by metaperl on Thu, 03/24/2005 - 10:22pm.

[20:18] [Darius] import List;main = interact $ concatMap (\c -> case c of "<" ->\
">"; ">" -> "<"; _ -> c) . map (:[])

Submitted by metaperl on Wed, 07/20/2005 - 12:36pm.


araujo [~araujo@araujo.developer.gentoo] has quit IRC: "Programs must be written for people to read, and only incidentally for machines to execute"

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.