« first day (75 days earlier)      last day (1888 days later) » 

20:44
I just noticed ghci's :i does not like some expressions, e.g. :i (^2) does not work, while let f = (^2) then :i f works.
@flawr As far as I see :info consistently works with identifiers only.
E.g. :i 5 also fails, but :i x after x=5 works.
> :info name ...

> Displays information about the given name(s). For example, if name is a class, then the class methods and their types will be printed; if name is a type constructor, then its definition will be printed; if name is a function, then its type will be printed. If name has been loaded from a source file, then GHCi will also display the location of its definition in the source.
21:10
I thought it must be something like that, but I would have loved it to work on all expressions like :t
@flawr Like display type and location if it is a name, and just the type otherwise?
You could define your own command with :def [name] [expr]
@Laikoni oh!
Is there a function like (a->b->c) -> (e->a) -> (e->b) -> (e->c)?
Just noticed for the function monad, <$> is the same as .
and (>>=) is the "mirror image" of (<*>)
21:29
@flawr I think that's liftM2 in the function monad.
@Laikoni exactly, thanks!
Too bat Control.Monad is so long =/
@flawr I found it by asking pointfree.io to convert f g a b e=g(a e)(b e) and it just answered f = liftM2.
Oh that is neat:)
@flawr I think you have asked this before
Oct 11 at 21:01, by flawr
Something like (a->b) -> (a->c) -> (b->c->d) -> (a -> d)
You can use f.g<*>h for f (g e) (h e)
In my defense: the arguments are in the other order:D
@H.PWiz Ah that makes things easier, thanks!
I need to start to write this stuff down=/
21:41
@flawr f.g<*>h is already on the star board :D
how am I supposed to understand this cryptic stuff ^^
for context: I'm working on this challenge: codegolf.stackexchange.com/questions/150936/…
(I'm here so far: Try it online!)
@flawr I have a 86 byte solution
dang, I'm on 96
Without imports, if that helps.
21:58
whaat
this is my solution now: Try it online!
OP allowed input as string, so you don't need show
My solution: Try it online!
ah read.pure.maximum<$> span(==x)r is clever!
Took me a while to realize you're using the (,)e functor/monad/applicative/whatever
I think xnor gave me this tip once and since then it has stuck.
I mean if I see it I can figure out what is going on, but there are so many instances of those typeclasses that I never remember when writing my own code
85 bytes with n^(1+length b) -> n^length(x:b): Try it online!
@flawr I think most of them are rarely useful for golfing.
22:11
when are you gonna post it? when you're at 10 bytes? :)
@Laikoni This is the same as (f.g)<*>h, right?
When I finished writing the explanation. :)
@flawr Yes
Prelude> :i (.)
(.) :: (b -> c) -> (a -> b) -> a -> c   -- Defined in `GHC.Base'
infixr 9 .
Prelude> :i <$>
(<$>) :: Functor f => (a -> b) -> f a -> f b
        -- Defined in `Data.Functor'
infixl 4 <$>
The infix level of (.) is higher than the one of (<*>).
22:29
@flawr Posted
@flawr There is a problem with the solution: As far as I see 88000 should be True because of 2^3=8, but your solution checks 2^3=88 and returns False.
Ok, nimi already posted a comment five minutes ago.
With the exact same example o.O
Fixed it
23:10
good night guys
good night

« first day (75 days earlier)      last day (1888 days later) »