Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Whenever people agree with me, I always think I must be wrong. -- Oscar Wilde


devel / comp.lang.lisp / Re: Found Solution ...

SubjectAuthor
* Q: Compare two list'sJens Kallup
`* Found Solution ...Jens Kallup
 `* Re: Found Solution ...Jeff Barnett
  `- Re: Found Solution ...Jens Kallup

1
Q: Compare two list's

<k05ehsF230fU2@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17281&group=comp.lang.lisp#17281

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: kallup-dev@web.de (Jens Kallup)
Newsgroups: comp.lang.lisp
Subject: Q: Compare two list's
Date: Sat, 17 Dec 2022 09:56:28 +0100
Lines: 57
Message-ID: <k05ehsF230fU2@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: individual.net lZLFdriW9koT0+M/RqqgJA5ZB86+1+fEiUr9LZiZyUC5DAiIMd
Cancel-Lock: sha1:U3NsPGRPOIwpoYyj7leTACyrC1E=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.0
Content-Language: en-US
X-Antivirus: Avast (VPS 221216-4, 16.12.2022), Outbound message
X-Antivirus-Status: Clean
 by: Jens Kallup - Sat, 17 Dec 2022 08:56 UTC

Hello,
the Code bellow, give me NIL on last line - but I expected T.
I used SBCL in my test's:

Thanks for reading
Jens Kallup

(defvar *grammar*)
(defvar *alist*)

(defvar *i0*)
(defvar *i1*)

(setq *alist*
'(
(1 . ich)
(2 . du)

(10 . habe)
(20 . dich)

(30 . gefragt)
)
)

(setq *grammar*
'((1)
(1 10)
(1 10 20)
(1 10 20 30)))

(setq *i0* (assoc '1 *grammar*))
(setq *i1*
(progn
(cdr (assoc '1 *alist* ))
(cdr (assoc '10 *alist* ))
)
)

(setq *i0* (loop for x in '(1 10) collect (car (assoc x *alist* ))))
(setq *i1* (loop for y in '(1 10) collect (cdr (assoc y *alist* ))))

(print *i0* )
(print *i1* )

(defun list= (l1 l2 &key (test #'equal))
(loop for i in l1
for j in l2
always (funcall test i j)))

(print (list= '(ich habe) '(*i1*) :test #'equal))

--
Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft.
www.avast.com

Found Solution ...

<k05l2fF357kU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17282&group=comp.lang.lisp#17282

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: kallup-dev@web.de (Jens Kallup)
Newsgroups: comp.lang.lisp
Subject: Found Solution ...
Date: Sat, 17 Dec 2022 11:47:43 +0100
Lines: 47
Message-ID: <k05l2fF357kU1@mid.individual.net>
References: <k05ehsF230fU2@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: individual.net 5Bb9dKH3FQkzLmYYyFMyhgqSI3JLTCOEl8y4xSGO8OJXMMjYAv
Cancel-Lock: sha1:Dfxx1q35boPSiNsRqjZz3KUZUdE=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.0
Content-Language: en-US
In-Reply-To: <k05ehsF230fU2@mid.individual.net>
X-Antivirus: Avast (VPS 221216-4, 16.12.2022), Outbound message
X-Antivirus-Status: Clean
 by: Jens Kallup - Sat, 17 Dec 2022 10:47 UTC

(defvar *grammar*)
(defvar *alist*)

(defvar *i0*)
(defvar *i1*)
(defvar *i2*)

(setq *alist*
'(
(1 . ich)
(2 . du)

(10 . habe)
(20 . dich)

(30 . gefragt)
)
)

(setq *grammar*
'((1)
(1 10)
(1 10 20)
(1 10 20 30)))

(setq *i0* (assoc '1 *grammar*))
(setq *i1*
(progn
(cdr (assoc '1 *alist* ))
(cdr (assoc '10 *alist* ))
)
)

(setq *i0* '(1 10 20))

(setq *i1* (loop for x in *i0* collect (car (assoc x *alist* ))))
(setq *i2* (loop for y in *i0* collect (cdr (assoc y *alist* ))))

(print *i1* )
(print *i2* )

(print (equal '(ich habe dich) *i2*))

--
Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft.
www.avast.com

Re: Found Solution ...

<tnl4co$3ncj7$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17290&group=comp.lang.lisp#17290

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jbb@notatt.com (Jeff Barnett)
Newsgroups: comp.lang.lisp
Subject: Re: Found Solution ...
Date: Sat, 17 Dec 2022 12:13:18 -0700
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <tnl4co$3ncj7$1@dont-email.me>
References: <k05ehsF230fU2@mid.individual.net>
<k05l2fF357kU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
Injection-Date: Sat, 17 Dec 2022 19:13:28 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="6afc173bd39ff5db25d01645d3a89f7a";
logging-data="3912295"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+w7oFS9oqS4we086/nA6ZqvYAMxq3pD0c="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.0
Cancel-Lock: sha1:4A/yySWKYI699f4rLFiIXVPfCkM=
Content-Language: en-US
In-Reply-To: <k05l2fF357kU1@mid.individual.net>
 by: Jeff Barnett - Sat, 17 Dec 2022 19:13 UTC

On 12/17/2022 3:47 AM, Jens Kallup wrote:
> (defvar *grammar*)
> (defvar *alist*)
>
> (defvar *i0*)
> (defvar *i1*)
> (defvar *i2*)
>
> (setq *alist*
>     '(
>         (1 . ich)
>         (2 . du)
>
>         (10 . habe)
>         (20 . dich)
>
>         (30 . gefragt)
>     )
> )
>
> (setq *grammar*
>   '((1)
>     (1 10)
>     (1 10 20)
>     (1 10 20 30)))
>
> (setq  *i0* (assoc '1 *grammar*))
> (setq  *i1*
>     (progn
>         (cdr (assoc '1  *alist*  ))
>         (cdr (assoc '10 *alist*  ))
>     )
> )
And what is/was the point of the above form? Its equivalent to
(setq *i1* (cdr (assoc 10 *alist*)))
unless (cdr (assoc 1 *alist*)) causes an error.
> (setq *i0* '(1 10 20))
>
> (setq *i1* (loop for x in *i0* collect (car (assoc x *alist* ))))
> (setq *i2* (loop for y in *i0* collect (cdr (assoc y *alist* ))))
>
> (print *i1* )
> (print *i2* )
>
> (print (equal '(ich habe dich) *i2*))--
Jeff Barnett

Re: Found Solution ...

<k07qqfFednmU2@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17293&group=comp.lang.lisp#17293

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: kallup-dev@web.de (Jens Kallup)
Newsgroups: comp.lang.lisp
Subject: Re: Found Solution ...
Date: Sun, 18 Dec 2022 07:38:08 +0100
Lines: 124
Message-ID: <k07qqfFednmU2@mid.individual.net>
References: <k05ehsF230fU2@mid.individual.net>
<k05l2fF357kU1@mid.individual.net> <tnl4co$3ncj7$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net RNMVcjDW+rUNxfS8enyxqAdVspE5SIGoBPVcywnJw09Z0hTXHi
Cancel-Lock: sha1:5yMBB5pJE9DyM9oqxvTKm+HOie8=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.0
Content-Language: en-US
In-Reply-To: <tnl4co$3ncj7$1@dont-email.me>
X-Antivirus: Avast (VPS 221218-0, 18.12.2022), Outbound message
X-Antivirus-Status: Clean
 by: Jens Kallup - Sun, 18 Dec 2022 06:38 UTC

Am 17.12.2022 um 20:13 schrieb Jeff Barnett:

> And what is/was the point of the above form? Its equivalent to
>  (setq *i1* (cdr (assoc 10 *alist*)))
> unless (cdr (assoc 1 *alist*)) causes an error.

This was only a demonstration, on what I have worked out.
Here comes a little Snippet from my code base:

;; ----------------------------------------------------
;; test1.lisp - a simple test.
;;
;; (c) 2022 by Jens Kallup - paule32
;; all rights reserved.
;;
;; Notes (2022-12-18):
;; - you have to install "quicklisp.lisp" on seperate
;; file. Then you have to create the file "quick.ok"
;; in the working directory where this source file(s)
;; exists.
;; ----------------------------------------------------
(format T "Please wait, loading packages ...~%")

#-quicklisp
(let ((quicklisp-init "quicklisp/setup.lisp"))
(when (probe-file quicklisp-init)
(load quicklisp-init)))

(with-open-stream (*standard-output* (make-broadcast-stream))
(ql:quickload :mito)
(ql:quickload '(:qtools :qtcore :qtgui))
)

;; ----------------------------------------------------
;; global scope
;; ----------------------------------------------------
(defvar *grammar*)
(defvar *alist*)

(defvar *i0*)
(defvar *i1*)
(defvar *i2*)

;; ----------------------------------------------------
;; functions:
;; ----------------------------------------------------
(defun test1 () (progn
(setq *alist*
'(
(1 . ich)
(2 . du)

(10 . habe)
(20 . dich)

(30 . gefragt)
))

(setq *grammar*
'((1)
(1 10)
(1 10 20)
(1 10 20 30)))

(setq *i0* (assoc '1 *grammar*))
(setq *i1* (progn
(cdr (assoc '1 *alist* ))
(cdr (assoc '10 *alist* ))
))

(setq *i0* '(1 10 20))

(setq *i1* (loop for x in *i0* collect (car (assoc x *alist* ))))
(setq *i2* (loop for y in *i0* collect (cdr (assoc y *alist* ))))

(print *i1* )
(print *i2* )

(if (eq T (equal '(ich habe dich) *i2*))
(progn
(format T "~%Der Satz ist richtig.")
(exit)
)
(progn
(format T "~%Der Satz ist falsch .")
(exit)
)
)
))

;; ----------------------------------------------------
;; entry, exception handler ...
;; ----------------------------------------------------
(handler-case (progn
(with-open-file (stream "quick.ok"
:direction :input
:if-does-not-exist :error))
(format T "start test 1 ...~%")
(test1))
(error (c) (progn
(format T "QuickLisp missing.~%")
(load "quicklisp")
(exit)
)))

The main problem is, how to check, if Quicklisp is installed,
and when not, how can the Application install as needs...
The Problem there is, that I can not include the following code
within the code above, I posted:

(load "quicklisp.lisp")
(quicklisp-quickstart:install)

.... the rest of the code ...

Thanks for reading
Jens

--
Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft.
www.avast.com

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor