--- Log opened Fri Jan 27 00:00:43 2006 00:04 < Arnia> Can someone please quickly run an eye over a mockup of a piece of syntax to tell me if it is possible to implement as a macro: 00:05 < Arnia> ruleset [Statement] { 00:05 < Arnia> Inherits(m,p) : t1, Inherits(s,m) : t2 |- Inherits(s,p) : f_ded(t1,t2) 00:05 < Arnia> Inherits(p,m) : t1, Inherits(s,m) : t2 |- Inherits(s,p) : f_abd(t1,t2) 00:05 < Arnia> } 00:05 < Arnia> I'm hoping to put together a library that will make it relatively easy to build reasoners for logics 00:31 -!- Arnia [n=jgeldart@1-40-101-159.adsl.legend.co.uk] has quit [Remote closed the connection] 00:35 -!- Arnia [n=jgeldart@1-40-101-159.adsl.legend.co.uk] has joined #nemerle 02:11 -!- kanru [n=kanru@59-121-145-126.dynamic.hinet.net] has joined #nemerle 04:28 -!- kanru [n=kanru@59-121-145-126.dynamic.hinet.net] has quit [Remote closed the connection] 04:38 -!- kanru [n=kanru@59-121-145-126.dynamic.hinet.net] has joined #nemerle 06:08 -!- m3ga [n=erikd@202.53.187.9] has joined #nemerle 06:32 -!- m3ga [n=erikd@202.53.187.9] has quit [Read error: 110 (Connection timed out)] 07:06 -!- m3ga [n=erikd@202.53.187.9] has joined #nemerle 07:45 -!- m3ga [n=erikd@202.53.187.9] has quit [Read error: 110 (Connection timed out)] 08:20 -!- user317 [n=aeyakove@ip68-101-143-206.sd.sd.cox.net] has joined #nemerle 08:24 < user317> is there a way to get a substring from a string of a certain length? 08:34 < kanru> yes, you can use String.Substring () 09:00 < user317> do nemerle strings inherit from c# strings? 09:00 < malekith> Arnia: unfortunately this is not a valid Nemerle expression, it would have to be tweaked a bit 09:00 < malekith> user317: yes 09:00 < Arnia> malekith: How so? 09:01 < malekith> Arnia: that is parser will choke on usage of , 09:01 < malekith> Arnia: lemme think a bit 09:02 < malekith> Arnia: something like: 09:02 < malekith> ruleset [Statement] { 09:02 < malekith> [Inherits(m,p) : t1, Inherits(s,m) : t2] |- Inherits(s,p) : f_ded(t1,t2); 09:02 < malekith> [Inherits(p,m) : t1, Inherits(s,m) : t2] |- Inherits(s,p) : f_ded(t1,t2); 09:02 < malekith> } 09:03 < malekith> you could even drop the { ... } and ; in indentation syntax 09:03 -!- nazgul` [n=d47f5f7d@lilith.ii.uni.wroc.pl] has joined #nemerle 09:03 -!- mode/#nemerle [+o nazgul`] by ChanServ 09:04 < malekith> Arnia: you could also use (Inherits(m,p) : t1, Inherits(s,m) : t2) 09:04 < malekith> Arnia: or Inherits(m,p) : t1; Inherits(s,m) : t2 09:04 < malekith> Arnia: or Inherits(m,p) : t1 && Inherits(s,m) : t2 09:04 < Arnia> malekith: Yeah. I used 'normal' braces syntax cos my real application is going to have *long* rules 09:05 < Arnia> malekith: How do you suggest expressing conditions? 'where'? 09:05 < malekith> Arnia: yes, it's infix operator 09:06 < malekith> Arnia: when and with also are 09:06 < Arnia> (I come from a Haskell and Z influenced background so my ideal syntax would require unicode operators :) 09:06 < malekith> Arnia: hm, after some twaeking of lexer this should be possible 09:07 < malekith> Arnia: I would go with && and 'when', because when has lower priority than && 09:07 < Arnia> Does make the rules look uglier though. But never mind :) 09:08 < malekith> Arnia: hm, and (foo,bar) |- baz ? 09:09 < Arnia> I'm oddly keen on being able to use the syntactic turnstile symbol though, as well as using the appropriate arrows to represent inheritance, implication etc 09:09 < Arnia> I liked the first alternative 09:09 < Arnia> [foo,bar] |- baz 09:09 < malekith> hm, but it looks like foo OR bar IMPLIES baz 09:09 < malekith> to me at least 09:09 < malekith> [...] often means clause in logic 09:10 < Arnia> Yeah, I know... although it means something closer to what I intend in Epigram's visual syntax 09:11 < malekith> oh, ok. 09:11 < Arnia> I'm a University of Durham student and thus indoctrinated in the Coq/LEGO/Epigram way. Sad, no? :) 09:12 < Arnia> The logic I'm working on first has two-priors at most (but sometimes there will be some conditionals) however there are some logics I'm going to try which will have more priors. I guess I'm worried that '&&' will introduce too much visual noise 09:13 < Arnia> But if [...] gives the wrong intuition then I shouldn't use that either :) 09:13 < malekith> we're here indoctrinated in SML only ;-) 09:13 < malekith> it may be just me 09:14 < Arnia> I take it braces cannot be repurposed :) 09:14 * malekith gotta go for a while 09:14 < Arnia> Ok, thanks very much for your advice :) 09:14 < malekith> Arnia: ah, btw, 09:14 < malekith> Arnia: you can use also commas and such, but you will have to transform stream of tokens into rules 09:14 < malekith> Arnia: not expressions, which is a bit harder 09:15 < malekith> public static IsIdBeginning (ch : char) : bool 09:15 < malekith> { 09:15 < malekith> Char.IsLetter (ch) || ch == '_' 09:15 < malekith> } 09:15 < Arnia> Ah, ok. I'm probably going to have to do that anyway in order to deal with variable unification etc 09:15 < malekith> oh, this means that unicode \lambda could be turned into identifier 09:15 < malekith> maybe we should change this to just EXCLUDE numbers and such and accept anything else 09:16 < Arnia> malekith: Would make it easier for foreign languages 09:16 < Arnia> Well, non-ASCII scripts 09:16 * Arnia is dozy today 09:16 * malekith is happy to use mostly-ASCII script :) 09:16 < malekith> but you're right 09:17 < Arnia> Although I'm only just starting the road to syntax extensions :) 09:18 * Arnia tried using P# to convert the inference rules of this logic to C# and failed miserably 09:18 < Arnia> P# seems to be broken at the moment... must find out if they have an IRC channel 09:25 < Arnia> For the record this is the sort of style I'd be aiming for: m ? s : truth1 && p ? m : truth2 ? p ? s : f_ded(truth1,truth2) 09:33 < malekith> and what is '?' ? 09:33 < malekith> or how does it read 09:33 < Arnia> Oh, the unicode isn't working 09:33 < user317> i am guessing its like ? in C 09:34 < malekith> oh, it was unicode... :) 09:34 < Arnia> Where ':' denotes the 'truth valuation' of the statement to the left 09:34 < Arnia> The one between variables, like m and s, are right-pointing arrows 09:34 < Arnia> The one between truth2 and p is a syntactic turnstile 09:35 < user317> a > b ? a : b is the same as if(a > b) a else b, right? 09:36 < malekith> user317: right, 09:37 < malekith> Arnia: i can tweak the lexer to accept unicode during the weekend, if you don't mind using the svn version 09:37 < Arnia> malekith: I already am using SVN :) I had a feeling I'd end up needing something that isn't there :) 09:37 < malekith> Arnia: ;) 09:38 < malekith> Arnia: ok, so just add infix operator --> for the arrow for now, and later you can change it 09:38 < malekith> Arnia: as in macros/core.n 09:38 < Arnia> malekith: yep, ok. Thanks very much for all your help 09:38 < malekith> n/p 09:39 < Arnia> If I get time, I'm going to look at implementing a packrat algorithm parser macro 09:40 < Arnia> Not sure if that will be useful for anyone here, but I'll put a bzr branch up anyway 10:11 < user317> i wish there was a way to make anonymous structures inline, something like def blah = (Foo=1.0, Bar="hello"), then you could do print(blah.Foo) 10:16 <@nazgul`> hm, I think that it could be done by macro 10:16 <@nazgul`> this macro would just create a new class in current namespace 10:17 <@nazgul`> it could for example hold a map with names, so you would end up with the same class/struct if you used the same names 10:17 < user317> yea, that would be pretty neat 10:18 < user317> cause remembering whats what in tuples is kind of a headache 11:03 -!- Arnia [n=jgeldart@1-40-101-159.adsl.legend.co.uk] has left #nemerle ["Kopete 0.10.4 : http://kopete.kde.org"] 12:52 < malekith> user317: the problem is what would be the type of this thing, because I assume you want to pass it to some functions. If it was only for local functions that wouldn't be much of a problem I guess, but for global it may be... 12:57 -!- kanru [n=kanru@59-121-145-126.dynamic.hinet.net] has quit ["Leaving"] 13:12 <@nazgul`> malekith, I guess it would just work like in C# 3.0 - with type inference it can be useful with local variables and local functions 13:30 < malekith> nazgul`: right 13:33 <@nazgul`> and it would be even more useful in nemerle, because of type-inferenced local function, which C# is not going to have 13:34 <@nazgul`> it would just be a little bit problematic to connect generation of such classes with type-inference - that is we must know types of fields when generating the class 13:35 < malekith> we would have to introduce some structural types I guess 13:35 < malekith> I wonder if this is going to be hard 13:35 < malekith> like {Foo:int, Bar:string} 13:36 * malekith speaks today during ZJP seminary, about automated theorem proving 13:36 * malekith should be preparing :) 13:37 <@nazgul`> I tought just about inline (Foo = expr1, Bar = expr2) ===> _N_new_class_Foo_Bar (expr1, expr2) && class _N_new_class_Foo_Bar { Foo : type_of_expr1 ... } 13:40 < malekith> but then you need to know the exact type of expr1,2 at the point where inline is used 13:40 < malekith> or maybe you can delay the macro if you don't 13:40 < malekith> hm 13:41 < malekith> this delay thing is really handy :-) 13:41 <@nazgul`> hm, the delay in macro would work here? 13:41 < malekith> yes, 13:42 <@nazgul`> because we need to know the resulting class, or maybe we could just use it "by name" 13:42 < malekith> we don't 13:42 <@nazgul`> ah, the entire inline macro execution would be delayes 13:42 <@nazgul`> ok :) 13:42 < malekith> yeah 14:59 -!- kanru [n=kanru@59-121-145-126.dynamic.hinet.net] has joined #nemerle 15:08 -!- d [i=d@terror.icm.edu.pl] has quit [Remote closed the connection] 17:03 -!- kanru [n=kanru@59-121-145-126.dynamic.hinet.net] has quit [Read error: 110 (Connection timed out)] 18:34 -!- Arnia [n=jgeldart@1-40-101-159.adsl.legend.co.uk] has joined #nemerle 19:35 -!- Arnia [n=jgeldart@1-40-101-159.adsl.legend.co.uk] has quit [Connection timed out] 20:28 -!- nazgul` [n=d47f5f7d@lilith.ii.uni.wroc.pl] has quit ["CGI:IRC"] 22:46 -!- user317 [n=aeyakove@ip68-101-143-206.sd.sd.cox.net] has quit [Remote closed the connection] --- Log closed Sat Jan 28 00:00:44 2006