ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
_whitelogger has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
wineroots has quit [Remote host closed the connection]
_whitelogger has joined #picolisp
wineroots has joined #picolisp
aw- has quit [Quit: Leaving.]
aw- has joined #picolisp
m_mans has joined #picolisp
m_mans has quit [Client Quit]
<beneroth> Regenaxer, I struggle to achieve recursion with pilog
* beneroth feels he must use 'permute
<Regenaxer> Fight! :)
<beneroth> Arrrr!!
<beneroth> I'm sure permute is not the weapon
<beneroth> I think I need an additional rule!
<Regenaxer> the permute predicate is not really recursion, but a generator
<beneroth> well I have like...
<beneroth> (member @Var @SomeList)
<Regenaxer> How about this example for recursion? http://ix.io/2QbJ
<beneroth> thx
<beneroth> I try
<Regenaxer> Good old factorial, the most-demonstrated recursion case
<beneroth> I have like..
<beneroth> @List *SomeList
<beneroth> @Target SomeSymbol
<beneroth> (member @Var @List)
<beneroth> (leads-to @Var @Target)
<beneroth> that works
<Regenaxer> ok
<beneroth> now I want also all (leads-to @N @Var)
<beneroth> like indirect (leads-to)
<beneroth> I managed up to 2 level with or, but I need recursion for full depth
<beneroth> (I have uniq rule afterwards to not get multiple @Var)
<Regenaxer> ok, member generayes values in @Var
<beneroth> aye
<beneroth> (leads-to) is a condition
<beneroth> true or false
<beneroth> now I want additional all @Var which lead-to a @Var which leads-to @Target
<Regenaxer> So something with (... T (fail)) ?
<beneroth> maybe I will need that to stop endless recursion
<beneroth> but I struggle with having the generator which gives all possible @Var which leads-to a (leads-to @Var @Target)
<beneroth> so it is a permutation, in the sense of the word
<beneroth> @Var is still limited by haivng to be member of @List
<beneroth> e.g. (be leads-to (A B)) (be leads-to (B C))
<beneroth> now I want to get A when I specify C as target
<Regenaxer> not @A and @C ?
<beneroth> both of them, right
<beneroth> well
<beneroth> A and B I expect as results
<Regenaxer> yeah, A and C are just constants
<Regenaxer> ok
<beneroth> here A B and C are all constants, all values
<beneroth> not variables
<beneroth> A -> B -> C -> D
<Regenaxer> ok
<Regenaxer> so facts
<beneroth> C2 -> D
<beneroth> aye
<beneroth> give me all facts which lead-to D, so I expect (A B C C2)
<beneroth> I must create a rule.. a second rule to leads-to I guess
<Regenaxer> Perhaps really first study Prolog-thinking in general
<Regenaxer> how to structure such a task
<beneroth> maybe.. but I want it now xD
<beneroth> I know what I want and I'm sure its possible :D
<beneroth> ok
<beneroth> Regenaxer, one question for you
<beneroth> @ is a anonymous variable in pilog
<beneroth> where we don't care about its value
<Regenaxer> yes
<beneroth> how if I want to ignore multiple variables? (equal @ @) is always true, no?
<Regenaxer> I think so
<Regenaxer> as '@' is not unified
* beneroth makes progress. Managed to build endless recursion xD
<Regenaxer> But you cannot use (equal @ @) in any way
<Regenaxer> i.e. cannot pass values into it
<beneroth> yeah
<beneroth> I want to ignore two variables
<beneroth> but I guess I cannot use @ for both, as that would require them to be equal
<beneroth> I simply don't care about both two variables in this specific case
<Regenaxer> hmm, no, (equal @A @A) requires them to be equal
<beneroth> I mean like
<beneroth> (be some-rule (@X @Y) (other-rule @X @) (other-rule @ @Y))
<Regenaxer> I think this does not work
<Regenaxer> remember this is not Lisp-evaluation
<beneroth> yeah I grokked that, I thinl
<Regenaxer> Prolog substitutes each value, and then matches
<Regenaxer> but @ is not substituted
<beneroth> so @ acts like NULL in SQL? then (not (equal @ @)) would be true
<beneroth> I mean
<Regenaxer> You never really need @
<beneroth> don't I use @ if I want ignore some variables in a rule?
<Regenaxer> you can use @foo if @foo is not used anywhere else
<beneroth> ok
<Regenaxer> yeah, just dont use it
<Regenaxer> eg @fio
<beneroth> all pilog variables are always "global", even when they are within a rule, right?
<beneroth> ok
<beneroth> that is my current strategy, T
<Regenaxer> no, local in this level
<Regenaxer> nothing is global here
<Regenaxer> Prolog does not "execute" in the normal way. It only matches patterns, nested constants and variables. A match happens if all constants are the same, and varibles are unified with the corresponding variables or constants
<Regenaxer> sorry, must stop
<Regenaxer> bbl
<beneroth> got that
<beneroth> ok
<beneroth> see you later, thanks anyway :)
<Regenaxer> :)
<beneroth> I give up for now
<beneroth> I will just recurse on picolisp level, repeatedly calling pilog..
orivej has joined #picolisp
<Regenaxer> oh :(
<Regenaxer> I know these problems, switching the brain between Lisp and Pilog
<Regenaxer> It is very different, and the normal thinking of function calls, arguments and variables does not apply to Pilog
<Regenaxer> A variable is not passed into a predicate. It immediately replaces all its occurrances in the body with its value, and the resulting body is used for further matching
rob_w has joined #picolisp
_whitelogger has joined #picolisp
<tankf33der> done. afk.
<Regenaxer> Impressive! Thanks!
f8l has quit [Remote host closed the connection]
f8l has joined #picolisp
rob_w has quit [Quit: Leaving]
theruran has quit [Ping timeout: 260 seconds]
theruran has joined #picolisp
aw- has quit [Quit: Leaving.]