u0_a183 has quit [Ping timeout: 260 seconds]
pierpal has joined #picolisp
pierpal has quit [Ping timeout: 260 seconds]
crides has joined #picolisp
crides has quit [Read error: Connection reset by peer]
crides has joined #picolisp
crides has quit [Ping timeout: 265 seconds]
pierpal has joined #picolisp
pierpal has quit [Quit: Poof]
pierpal has joined #picolisp
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #picolisp
<
tankf33der>
morning
<
tankf33der>
Regenaxer:
<
tankf33der>
pilog doesnt support rule within rule, right ?
<
Regenaxer>
Morning
<
tankf33der>
is it possible to workaround? :/
<
Regenaxer>
What does that do?
<
tankf33der>
is just a rule in rule
<
Regenaxer>
You use 'assert' to add rules at runtime
<
Regenaxer>
and 'retract' to remove
<
tankf33der>
this is not this case.
<
Regenaxer>
assert and retract are also in Prolog
<
Regenaxer>
I don't know what 'once' and 'chain' do in Prolog
<
Regenaxer>
I meant asserta/1
<
Regenaxer>
and assertz
<
Regenaxer>
not assert
<
tankf33der>
add_stone(stone(A,B),FreeSides,RestStones,Chain) :-
<
tankf33der>
i mean this !!!
<
Regenaxer>
yes, look up asserta
<
tankf33der>
ok then
<
Regenaxer>
and assertz
<
Regenaxer>
Something like (assertz (stone (@A @B) (freeSides) (Rest ...
<
tankf33der>
simple example.
<
tankf33der>
========
<
tankf33der>
all i want is convert this code to pilog
<
Regenaxer>
Should be straightforward, not?
<
tankf33der>
this rule within rule confuse me a lot first time.
<
Regenaxer>
It is just adding a property
<
Regenaxer>
Pilog rules are in the 'T' property
<
tankf33der>
how to convert this then ? :(
<
Regenaxer>
assertz or asserta
<
Regenaxer>
Where is the problem?
<
Regenaxer>
See example above
<
Regenaxer>
you want to code 'mike'?
<
Regenaxer>
no need for a special rule
<
tankf33der>
i want convert this three line to pilog
<
Regenaxer>
(? (assertz (stone 1 2)))
<
Regenaxer>
(? (assertz (stone 2 2)))
<
Regenaxer>
(? (stone @A @A))
<
tankf33der>
all above known
<
tankf33der>
but there is rule mike
<
tankf33der>
third line
<
Regenaxer>
Try call/1
<
Regenaxer>
I was wrong above
<
Regenaxer>
must be (? (assertz (stone (1 2))))
<
Regenaxer>
then: (be mike (@CL) (call @CL))
<
Regenaxer>
(? mike (stone @A @B))
<
tankf33der>
i will use mike inside rules
<
tankf33der>
(mike (stone @A @B))
<
tankf33der>
doesnt work
<
tankf33der>
i will try without call then
<
tankf33der>
i meant (? (mike (stone @A @B)))
orivej has joined #picolisp
styx has joined #picolisp
freemint has joined #picolisp
styx has quit [Quit: styx]
freemint has quit [Ping timeout: 248 seconds]
freemint has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej has joined #picolisp
xificurC has joined #picolisp
<
Regenaxer>
I still don't understand
orivej has quit [Ping timeout: 244 seconds]
<
Regenaxer>
ok, tried it:
<
Regenaxer>
(be mike ((@P @X @Y))
<
Regenaxer>
(call @P @X @Y) )
<
Regenaxer>
: (? (mike (stone @A @B)))
<
Regenaxer>
@A=1 @B=2
<
Regenaxer>
@A=2 @B=2
<
Regenaxer>
Alternate syntax:
<
Regenaxer>
(be mike (@P @X @Y)
<
Regenaxer>
(call @P @X @Y) )
<
Regenaxer>
: (? (mike stone @A @B))
<
Regenaxer>
@A=1 @B=2
<
Regenaxer>
@A=2 @B=2
orivej has joined #picolisp
groovy2shoes has quit [Excess Flood]
groovy2shoes has joined #picolisp
<
tankf33der>
problem is mike should be true when first and second argument are equal
<
tankf33der>
check this again
<
Regenaxer>
That's the normal Prolog behavior
<
Regenaxer>
: (? (mike stone @A @A))
<
Regenaxer>
: (? (mike stone @A @B) (equal @A @B))
<
Regenaxer>
@A=2 @B=2
<
Regenaxer>
I picked the first definition:
<
Regenaxer>
(be mike (@P @X @Y) # (? (mike stone @A @B))
<
Regenaxer>
(call @P @X @Y) )
<
Regenaxer>
With the other
<
Regenaxer>
(be mike ((@P @X @Y)) # (? (mike (stone @A @B)))
<
Regenaxer>
(call @P @X @Y) )
<
Regenaxer>
you get
<
Regenaxer>
: (? (mike (stone @A @B)))
<
Regenaxer>
@A=1 @B=2
<
Regenaxer>
@A=2 @B=2
<
Regenaxer>
: (? (mike (stone @A @A)))
<
Regenaxer>
: (? (mike (stone @A @B)) (equal @A @B))
<
Regenaxer>
@A=2 @B=2
<
Regenaxer>
All a result of how {Pi,Pro}log matches and unifies patterns
orivej has quit [Ping timeout: 260 seconds]
freemint has quit [Ping timeout: 265 seconds]
erkin has joined #picolisp
<
tankf33der>
i will play, thanks
<
tankf33der>
this is my idea
<
tankf33der>
behaves like prolog now.
<
tankf33der>
all this for init_freesides
<
tankf33der>
check how it works differently if stone A A and stone A B
<
tankf33der>
so i need do emulate init_freesides on next step.
<
Regenaxer>
Yes, but falling back to Lisp is not so elegant
<
Regenaxer>
Are you sure? I would expect (solve '((mike (stone 'a 'a)))) to return false
<
Regenaxer>
otherwise 'mike' is like 'equal/2' ?
<
Regenaxer>
A Lisp solution is usually less useful also because it does not work backwards
<
tankf33der>
im just translate prolog to pilog
<
tankf33der>
mike stone a a returns true in prolog
<
tankf33der>
this prolog code chains domino stones
<
tankf33der>
thats why it should understands 1,2 and 2,2
<
Regenaxer>
I don't want to dig into Prolog code. Can you tell me in words what
*exactly* 'miki' should do?
<
Regenaxer>
What is the difference to 'equal/2'? Does it need to support more than 2 args?
<
Regenaxer>
How about this?
<
Regenaxer>
(be mike (@A))
<
Regenaxer>
(be mike (@A . (@B . @L))
<
Regenaxer>
(equal @A @B)
<
Regenaxer>
(mike @B . @L) )
<
Regenaxer>
: (? (mike 1 1))
<
Regenaxer>
: (? (mike 1 2))
<
Regenaxer>
: (? (mike 1 1 1))
<
Regenaxer>
: (? (mike 1 1 2))
<
Regenaxer>
: (? (mike 7 @A 7))
<
Regenaxer>
: (? (mike 3 3 3 @X))
orivej has joined #picolisp
freemint has joined #picolisp
<
freemint>
Regenaxer to what would need to happen for minipicolisp to support databases?
<
Regenaxer>
and some POSIX calls, which by definition are not supported by miniPicoLisp
<
Regenaxer>
pread(), pwrite(), but most notably fcntl()
<
Regenaxer>
And for full support also pipe() and select()
freemint has quit [Ping timeout: 244 seconds]
freemint has joined #picolisp
alexshendi has joined #picolisp
erkin has quit [Quit: Ouch! Got SIGIRL, dying...]
pierpal has quit [Quit: Poof]
pierpal has joined #picolisp
orivej has quit [Ping timeout: 248 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #picolisp
alexshendi_ has joined #picolisp
alexshendi has quit [Ping timeout: 248 seconds]
styx has joined #picolisp
alexshendi_ has quit [Ping timeout: 256 seconds]
alexshendi has joined #picolisp
pierpal has quit [Quit: Poof]
pierpal has joined #picolisp
alexshendi_ has joined #picolisp
alexshendi has quit [Ping timeout: 256 seconds]
styx has quit [Quit: styx]
orivej has joined #picolisp
alexshendi has joined #picolisp
alexshendi_ has quit [Ping timeout: 256 seconds]
pierpal has quit [Ping timeout: 256 seconds]
freeemint has joined #picolisp
freemint has quit [Ping timeout: 245 seconds]
freemint has joined #picolisp
freeemint has quit [Ping timeout: 264 seconds]
<
N3k0>
how to define a predicate for floating point numbers?
<
N3k0>
isit even possible? does picolisp perceive any difference between scaled integers and normal numbers?