[02:41:57] fl0_id: anniepoo withdrew her application from cclaw, and I guess her interest in GF went there too [02:43:21] unfortunately I have no clue about prolog myself [03:48:04] *** Joins: drbean_ (~drbean@TC210-63-209-206.static.apol.com.tw) [05:58:20] *** Joins: drbean (drbean@2001:41d0:2:388f:b00b:face:0:7) [06:49:43] *** Joins: Lycurgus (~niemand@cpe-45-46-139-165.buffalo.res.rr.com) [06:50:32] i now see that GF does in fact express a theory of linguistics and a very powerful one consonant with Chomsky's thinking on language in general [06:51:26] namely that language expresses thought and that translation can proceed from that basis [06:52:21] or more pointedly that human language and thought, as opposed to other forms of language are close to the same thing [07:22:47] from my perspective, GF's stance on translation has been that it's not a universal rosetta stone, but we can totally handcraft domain-specific application grammars that do very well [07:23:19] but also, my passion has always been more about finding an elegant encoding for preposition contractions in obscure languages, rather than anything semantics/meaning [07:24:07] but if I hang around people who appreciate semantics, they appreciate my interest in morphosyntax :-P [07:25:06] btw Lycurgus, this was fl0_id's prolog question: [07:25:07] 17:46:23 < fl0_id> I do hang out there. ofc it is not totally 'mute' but as good as. This is measured over last several days. [07:25:08] 17:47:59 < fl0_id> mostly I want to find out if I can use SWISH like a prolog shell, modifying knowledge bases, so that subsequent queries use a modified kb. in swish at least, the default is that it always uses the original version. which is fine most of the time, but not always [07:27:29] right, well SWISH is a web interface, which by it's nature ought to be restricted [07:27:38] *its [07:28:12] contraction is awfully narrow, i'd at least go for full anaphora :) [07:29:20] also does contraction generalize? in the few langs I know it's pretty much an English thing [07:30:23] imagine it prolly does, just an artefact of my virtual monoglossy [07:31:25] also GF has a decent wiki article now i notices [07:31:30] *noticed [07:32:30] the only relation of GF to prolog i know of is ACE but there's gotta be more than that [07:33:14] (ACE in GF) [07:34:49] *** Joins: hlyhandgrnade (~u0_a529@106.208.68.209) [07:35:19] what is this channel about [07:35:44] the topic didn display for you? [07:35:58] nope [07:36:08] Topic for #gf is: Grammatical Framework · www.grammaticalframework.org · IRC logs at /irc [07:38:20] another thing I learned from Chomsky's talk is that there's a 600 page text on conjunction, "And" [07:50:53] this is quite interesting! [07:51:07] im going to try this one out [07:53:08] *** Quits: Lycurgus (~niemand@cpe-45-46-139-165.buffalo.res.rr.com) (Quit: Exeunt) [07:58:56] *** Quits: drbean_ (~drbean@TC210-63-209-206.static.apol.com.tw) (Ping timeout: 240 seconds) [08:01:23] hlyhandgrnade: welcome! if you have any questions, just ask here [08:02:21] we have also a google group https://groups.google.com/g/gf-dev and a small but growing selection of questions on stack overflow :-D https://stackoverflow.com/questions/tagged/gf [08:18:15] *** Quits: wmacmil (~wmacmil@c83-252-138-144.bredband.comhem.se) (Ping timeout: 246 seconds) [08:44:22] *** Joins: wmacmil (~wmacmil@c83-252-138-144.bredband.comhem.se) [09:04:32] *** Quits: wmacmil (~wmacmil@c83-252-138-144.bredband.comhem.se) (Ping timeout: 256 seconds) [09:53:24] *** Joins: wmacmil (~wmacmil@c83-252-138-144.bredband.comhem.se) [10:09:36] inariksit thanks for the update and sry for being offtopic... [10:11:01] I do get the restrictions, I even set up my own docker-swish to disable most, now the issue is only that while all functions work, they do not keep state. But yeah I might bother ##prolog some more or just accept it [11:08:41] haha no worries! it's just nice that there's talk on this channel [11:13:37] i'm wondering if anyone can help me understand how to properly deal with PGF repls [11:14:07] sure! what are you trying to do? [11:14:22] specifically, I'm trying to modify chapter 7 exercises 7.4 [11:14:38] https://github.com/wmacmil/AgdaGrammar/blob/main/pgfTests/QuerySystem.hs [11:14:48] so that I can transfer multiple functions [11:15:01] does it work for you or is haskell sad about conflicting dependencies? [11:15:13] it works for me [11:15:23] okay that's great :-D for many it doesn't without making a stack file [11:15:36] but i want to modify to handle multiple transfer functions [11:16:53] would you like to duplicate line 21 (lg,t:_):_ -> linearize gr lg (tr t) for several trs? [11:17:02] i think so [11:17:06] i'm not sure where it would go [11:17:24] like here's what happens when i run the repl [11:17:25] wmacmil@w:~/thesis/gf/exp/pgfTests$ ./query [11:17:25] is 3 prime ? [11:17:25] yes [11:17:25] is the sum of 3 , 4 and 5 prime ? [11:17:25] no [11:17:27] is the sum of 3 and the sum of 4 and 5 prime ? [11:17:29] no [11:17:31] quit [11:17:32] or you can also make line 9 into a list [11:17:35] bye [11:18:00] but I'd want not only the QA but include the various linearizations as well as the answers [11:18:13] so heres the proposed modified transfer function [11:18:13] wmacmil@w:~/thesis/gf/exp/pgfTests$ ./query [11:18:14] is 3 prime ? [11:18:14] yes [11:18:14] is the sum of 3 , 4 and 5 prime ? [11:18:14] no [11:18:15] is the sum of 3 and the sum of 4 and 5 prime ? [11:18:17] no [11:18:19] quit [11:18:21] bye [11:18:23] transfer :: Mode -> Tree -> Tree [11:18:25] transfer m = gf . trans . fg where [11:18:27] trans = case m of [11:18:29] MNone -> id [11:18:31] MAns -> answer [11:18:35] -- MMinimalize -> minimalize [11:18:37] -- MMaximize -> maximize [11:18:39] data Mode = MNone | MAns deriving Show -- | MMaximize | MMinimalize deriving Show [11:18:41] in Answer.hs [11:18:57] like I'm kinda following what Aarne did in the Cade code repository [11:19:15] here? https://github.com/wmacmil/AgdaGrammar/blob/main/pgfTests/Answer.hs [11:19:21] yeah [11:20:34] it's not there, transfer is just [11:20:35] transfer :: Tree -> Tree [11:20:35] transfer = gf . answer . fg [11:21:00] yeah i'm just proposing this!, sorry i haven't pushed to my git in a few minutes [11:21:58] ok right, no need to push, just wanted to make sure if you wanted me to see something I'm not seeing [11:22:19] like i [11:22:51] here's what aarne did [11:22:51] https://github.com/GrammaticalFramework/gf-contrib/blob/master/cade-2011/Trans.hs [11:23:05] but I have no idea what's going on inside his doTrans fucntion [11:27:13] for instance, `transfer MMinimalize t` calls this function on t https://github.com/GrammaticalFramework/gf-contrib/blob/master/cade-2011/TransProp.hs#L93-L109 [11:28:31] the t in https://github.com/GrammaticalFramework/gf-contrib/blob/master/cade-2011/Trans.hs#L17 is a PGF.Expr, but this line https://github.com/GrammaticalFramework/gf-contrib/blob/master/cade-2011/TransProp.hs#L11 turns that into GProp, from the Haskell version of the GF abstract syntax [11:29:44] ok [11:32:12] so what Aarne does in doTrans corresponds to you putting a list comprehension in translate, where line 21 is now [11:33:17] instead of a single tr, aarne has a list of pairs (PGF.Expr, Mode) [11:33:48] Mode is kept in that pair just so that aarne can output it in the display function [11:35:54] but i'm super confused about how to do stuff in the monad [11:36:59] like i want something like (lg,t:_):_ -> linearize gr lg (tr t) [11:37:00] tr t = [transfer m t | m <- [MNone, MAns]] [11:37:03] (lg,t:_):_ -> linearize gr lg (tr t) [11:37:03] tr t = [transfer m t | m <- [MNone, MAns]] [11:37:54] but because i don't know the types of any of these functions, its really confusing where I should be dissecting the code [11:40:19] at least you'll need two nested unlines [11:40:25] the other one is in display [11:41:17] if you don't want to do fancy stuff like print out the mode (and I don't know whtat that noFreeVars test is), you can do something like [11:42:10] (lg,t:_):_ -> unlines [ linearize gr lg tree | tree <- tr t] [11:43:06] and tr is like you defined, Expr -> [Expr] [11:57:29] i think i used a bad name for tr [11:58:29] and started getting even more confused, so I just fixed it with the most ugly ad hoc solution i could come up with, define a second transfer function, and then repeat that various points in QuerySystem.hs [11:58:37] its recently pushed if you're curious [11:59:30] that's a working solution :-P [11:59:40] it's probably better to get started fresh [11:59:52] because, also, the id function had the type [11:59:56] once you've implemented the naive solution, then you can discover yourself the more general solution [12:00:00] GQuestion -> GAnswer [12:00:08] i mean id had type [12:00:14] GQuestion -> GQuestion [12:00:24] but answer is [12:00:26] answer :: GQuestion -> GAnswer [12:00:58] so it was complaining that the "parameterized" transfer wasn't even well typed [12:01:19] right, yes [12:02:01] you could bypass that problem, if you have a startcat and a coercion from both Question and Answer to that cat [12:04:07] or if it is a meaningful difference, some transfer funs are from Question to Answer, and others Question -> Question, and you don't want to obscure it, then it sounds like a good idea to give loop two funs, or two lists of funs [12:04:27] one (list) for Q->A, other (list) for Q->Q [12:05:08] cool, thanks for your help [12:05:08] anyway, I think the solution you got is all you need to get further -- the more general solution with lists is just basic haskell programming, nothing PGF-specific [12:05:34] i think i might need to refresh some haskell anyways over the weekend [12:06:03] thanks for looking at this with me [12:06:20] no problem! [12:06:38] also, will try to rglify this over the course of the day :) [12:09:25] sounds good! [12:09:44] the same advice applies, don't start from aarne's complicated stuff, but do the most naive thing you come up with yourself and improve on that [12:10:49] that was the reason I made this https://github.com/inariksit/comp-syntax-2020/tree/master/lab2/grammar/dummy [12:10:57] for the computational syntax students last spring [12:11:11] they had trouble getting started from aarne's examples [12:29:35] were you TAing the course? [12:34:45] i didn't know about this gF book that aarne had [12:34:58] do you know who is TAing this spring? [12:58:08] no I wasn't even TAing it, I just zoom bombed an exercise session and the next thing I know, the students are emailing me for help :-D [12:58:24] (to be fair, some students were from previous years and I had actually been their TA that year) [12:59:02] I have no idea who will TA this year! there are no phd students who are working on GF at the moment [12:59:22] CLASP has tons of phd students, but I don't know how comfortable they are with GF [13:01:41] so my guess is someone from actual MLT, aarne himself, or one of his current masters' students [13:34:33] *** Joins: drbean_ (~drbean@TC210-63-209-37.static.apol.com.tw) [13:48:07] i kinda wanna email aarne [13:48:28] but i feel like it might be too much work for me to comfortably work on my thesis with [13:49:39] also, another question [13:50:18] so i'm writing a function to get rid of commas [13:50:19] expandNatQuestion :: GQuestion -> GQuestion [13:50:19] expandNatQuestion q = case q of [13:50:19] GIsOdd x -> GIsOdd (expandNatObj x) [13:50:19] GIsEven x -> GIsEven (expandNatObj x) [13:50:19] GIsPrime x -> GIsPrime (expandNatObj x) [13:50:20] expandNatObj :: GObject -> GObject [13:50:22] expandNatObj o = case o of [13:50:24] GNatObj x -> GNatObj (expandNat x) [13:50:26] [13:50:28] expandNat :: GNat -> GNat [13:50:30] expandNat n = case n of [13:50:34] GListFun f (GListNat xs) -> foldr1 (GBinFun f) (map expandNat xs) [13:50:36] GBinFun f x y -> GBinFun f (expandNat x) (expandNat y) [13:50:38] x -> x [13:50:45] above is the code I want to "compress" [13:51:03] was this what you were referencing with lenses when we discussed your dr. grammar [13:51:12] heres an example output from the shell [13:51:13] expandNatQuestion :: GQuestion -> GQuestion [13:51:13] expandNatQuestion q = case q of [13:51:13] GIsOdd x -> GIsOdd (expandNatObj x) [13:51:13] GIsEven x -> GIsEven (expandNatObj x) [13:51:13] GIsPrime x -> GIsPrime (expandNatObj x) [13:51:15] expandNatObj :: GObject -> GObject [13:51:17] expandNatObj o = case o of [13:51:19] GNatObj x -> GNatObj (expandNat x) [13:51:21] [13:51:23] expandNat :: GNat -> GNat [13:51:25] expandNat n = case n of [13:51:27] GListFun f (GListNat xs) -> foldr1 (GBinFun f) (map expandNat xs) [13:51:29] GBinFun f x y -> GBinFun f (expandNat x) (expandNat y) [13:51:31] x -> x [13:51:35] sorry, here: is the product of 3 , 4 and 5 prime ? [13:51:37] no [13:51:39] is the product of the product of 3 and 4 and 5 prime ? [13:55:14] like I want to fold, (or unfold [TODO] lists but since they are embedded lower down in the syntax tree, I have to add this boilerplate passing the expandNat all the way up the tree [14:12:01] wmacmil: the magical function is this https://hackage.haskell.org/package/lens-5.0.1/docs/Data-Data-Lens.html#v:template [14:12:19] "Find every occurrence of a given type a recursively that doesn't require passing through something of type a using Data, while avoiding traversal of areas that cannot contain a value of type a." [14:13:01] ok thank you [14:13:12] this is a relevant line https://github.com/smucclaw/nlg/blob/shibboleth/SAFE/Disambiguate.hs#L49 [14:13:50] the type signature of simplifyTerms is Move -> Move, and it's defined as [14:13:52] over template onlyHead [14:14:18] onlyHead is the function Term -> Term that I want to apply to all Terms in the Move [14:14:47] template in that case is of type Traversal' Move Term [14:16:51] tack [14:18:19] and over is this https://hackage.haskell.org/package/lens-5.0.1/docs/Control-Lens-Combinators.html#v:over [14:18:54] "Modify the target of a Lens or all the targets of a Setter or Traversal with a function." [14:19:13] so template is the Traversal' and onlyHead is the function [14:19:29] in order to have that work, you need to generate your haskell code with an extra flag [14:20:28] gf -make -f haskell --haskell=data [14:22:59] so in the generated Haskell file, all data types derive Data [14:23:07] which is needed for this lens magic to work [14:23:27] ah ok [14:23:39] i wasn just gonna message you about this error [14:23:40] Answer.hs:34:23: error: [14:23:40] • No instance for (Data.Data.Data GObject) [14:23:40] arising from a use of ‘template’ [14:23:56] but i think you answered before i could ask [14:26:15] :) [14:27:44] works like a charm [14:27:59] yay! [14:54:19] *** Quits: drbean_ (~drbean@TC210-63-209-37.static.apol.com.tw) (Quit: ZNC 1.8.2+cygwin2 - https://znc.in) [17:13:40] *** Quits: hlyhandgrnade (~u0_a529@106.208.68.209) (Read error: Connection reset by peer) [17:17:47] *** Joins: hlyhandgrnade (~u0_a529@121.244.51.92) [18:06:56] *** Quits: hlyhandgrnade (~u0_a529@121.244.51.92) (Ping timeout: 240 seconds) [18:08:17] *** Joins: hlyhandgrnade (~u0_a529@106.208.68.231) [18:16:19] *** Joins: hlyhandg1nade (~u0_a529@121.244.51.92) [18:16:20] *** Quits: hlyhandgrnade (~u0_a529@106.208.68.231) (Read error: Connection reset by peer) [19:40:22] *** Quits: hlyhandg1nade (~u0_a529@121.244.51.92) (Quit: Lost terminal) [21:36:32] *** Quits: drbean (drbean@2001:41d0:2:388f:b00b:face:0:7) (Quit: fBNC - https://bnc4free.com) [21:38:18] *** Joins: Flammie_ (~flammie@ircer.flammie.name) [21:38:18] *** Quits: ski (~ski@ed-3358-10.studat.chalmers.se) (Remote host closed the connection) [21:38:18] *** Joins: ski (~ski@ed-3358-10.studat.chalmers.se) [21:38:47] *** Quits: daherb (~daherb@principia.xen.prgmr.com) (Remote host closed the connection) [21:40:46] *** Quits: Flammie (~flammie@ircer.flammie.name) (Remote host closed the connection) [21:41:43] *** Joins: daherb (~daherb@principia.xen.prgmr.com) [21:42:00] *** Joins: drbean (drbean@2001:41d0:2:388f:b00b:face:0:7)