<avitusa>
Hi. I've been banging my head against something for about an hour now. Inside a syntax-parse, I want to apply two transformations to one of my matched patterns. Example: (syntax-parse stx [(~literal foo) #'(some-procedure (transformation2 (transformation1 foo)))]). It seems that I can't get transformation1 to happen before transformation2, so transformation2 is literally applied to (transformation1 foo)
<avitusa>
instead of its results. Any ideas/pointers?
<avitusa>
this is what my actual example looks like: [(_ rel c:int-col) #'(col-val-predicate rel (integer-predicate (reflexive-operator c.operator)) 'c.rhs c.lhs)]
pie___ has quit [Ping timeout: 268 seconds]
DGASAU has joined #racket
hjek has joined #racket
tautologico has quit [Quit: Connection closed for inactivity]
endformationage has joined #racket
DGASAU has quit [Ping timeout: 268 seconds]
<lavaflow>
I wish there was a way to search racket documentation for procedures that are functionally equivalent to a given one
<lavaflow>
so for example I've been using (define (split-list f l) (values (filter f l) (filter (negate f) l))) which is equivalent to partition
<lavaflow>
I know that's totally intractable, but I wish
hjek has quit [Quit: Leaving.]
hjek has joined #racket
avitusa has quit [Ping timeout: 272 seconds]
ziyourenxiang has quit [Ping timeout: 250 seconds]
avitusa has joined #racket
jao has joined #racket
acarrico has quit [Ping timeout: 240 seconds]
longshi has joined #racket
hjek has quit [Quit: Leaving.]
_whitelogger has joined #racket
tautologico has joined #racket
buyfn has joined #racket
ng0 has quit [Remote host closed the connection]
ng0 has joined #racket
pie___ has joined #racket
pie__ has quit [Remote host closed the connection]
tse has joined #racket
buyfn has quit [Quit: buyfn]
<lf94>
lavaflow, maybe with typed racket?
hjek has joined #racket
avitusa has quit [Ping timeout: 250 seconds]
buyfn has joined #racket
tautologico has quit [Quit: Connection closed for inactivity]
longshi has quit [Ping timeout: 252 seconds]
zmt01 has joined #racket
zmt00 has quit [Ping timeout: 264 seconds]
buyfn has quit [Quit: buyfn]
hjek has quit [Quit: Leaving.]
mahmudov has joined #racket
<lavaflow>
hmm, interesting idea
<lf94>
This is what Haskell has
<lf94>
err...what's it called...Hoogle.
<lf94>
Put your types in, returns all functions that use the same types.
zmt01 is now known as zmt00
joebobjoe has joined #racket
longshi has joined #racket
<jcowan>
Of course, Haskell docs typically give you no clue about which of said functions do what.
tumdum has joined #racket
<nisstyre>
jcowan: USE THE TYPES OMG :p
<nisstyre>
jcowan: I have the same problem tbh
<nisstyre>
ok I have all the type signatures great, now what
<nisstyre>
I usually have to read the source code
<nisstyre>
which is fine since haddock links to it usually
hjek has joined #racket
dan_f has joined #racket
dan_f has quit [Client Quit]
<lf94>
> read the source code
<lf94>
yea.
<lf94>
If the types were more strict, it'd be better
<lf94>
not strict...
<lf94>
more specific.
joebobjoe has quit [Ping timeout: 250 seconds]
mzan has left #racket [#racket]
<lavaflow>
I think the notion of a type system freeing programmers from the shackles of having to document is.. wishful thinking at best
<lf94>
It does help enormously
<lf94>
But yes, real documentation is best.
<lf94>
Int -> Int; impossible to tell what this does
<lf94>
Int -> Int * Int; ok, we are getting better
<lf94>
(Forall A:Int) A -> A * A; even better
<lf94>
(In fact I dont think you can get more specific)
<lf94>
You can tell now this functino does a^2
mzan has joined #racket
joebobjoe has joined #racket
<jcowan>
I don't understand the third one. Is * multiplication or union typing here?
longshi has quit [Quit: WeeChat 2.3]
joebobjoe has quit [Ping timeout: 250 seconds]
<nisstyre>
jcowan: product types i.e. (a, a)
<nisstyre>
so more like a struct
<nisstyre>
+ would be a union
<jcowan>
Right, I always make that mistake (reminiscent of reft/light confusion, which I also have)
<nisstyre>
fair enough, I sometimes have to think about it when people use that notation too
<nisstyre>
but it makes sense
<jcowan>
It does
<jcowan>
Then how can (Forall A:Int) A -> A * A possibly be the type of `square`?
<lf94>
Oh, I *was* using * as multiply
<lf94>
I'm sure there is a more standard way of doing this.
hjek has quit [Quit: Leaving.]
<lf94>
My type theory is pretty messed up. I've seen many things go by different names. It is confusing to me.
<nisstyre>
jcowan: I think it's meant to convey the fact that you can have any combination of two values that inhabit A
<lf94>
I think you can do a...product type like this
<lf94>
Multiply A A
<jcowan>
Yes, such as "factor n into two factors"
<lf94>
Where Multiply type can take 2 types
<nisstyre>
so, cartesian product
<nisstyre>
that's what we should really call them, cartesian product types
<lf94>
I have seen product type...but also just struct I guess
<lf94>
if you have any suggestions on a good source to sort myself out I'd appreciate it
<lf94>
A | A <- I thought this was union type
<nisstyre>
lf94: I don't really have a single good source
<lf94>
then you have tagged union type
<nisstyre>
there are books, but they're probably far more advanced than you need