Search found 607 matches
- Mon Jun 03, 2019 10:35 am
- Forum: newLISP in the real world
- Topic: Sum of digits
- Replies: 4
- Views: 4346
Re: Sum of digits
Getta via il 9. :) https://en.wikipedia.org/wiki/Casting_out_nines
- Sat Jun 01, 2019 11:37 pm
- Forum: newLISP newS
- Topic: newLISP language support for Visual Studio Code
- Replies: 9
- Views: 11062
Re: newLISP language support for Visual Studio Code
Nice!
I would collab but I don't use VS Code (nor linux, nor windows, nor mac). :)
(However, I just sent a PR on your other gh project.) Best, --Rick
I would collab but I don't use VS Code (nor linux, nor windows, nor mac). :)
(However, I just sent a PR on your other gh project.) Best, --Rick
- Thu May 30, 2019 9:18 pm
- Forum: newLISP in the real world
- Topic: Maximum Product Sublist
- Replies: 5
- Views: 4233
Re: Maximum Product Sublist
Hi rickyboy Hi cameyo! :) the sublist must contains only contiguous elements. But your functions are useful anyway :-) Ah, ok! Then my updated maxProd function is still very similar to my original. (define (maxProd lst) ;; lst must contain integers; note use of integer op `*`. (apply max (map (fn (...
- Thu May 30, 2019 6:57 pm
- Forum: newLISP in the real world
- Topic: Maximum Product Sublist
- Replies: 5
- Views: 4233
Re: Maximum Product Sublist
Here's my version. (define (maxProd lst) ;; lst must contain integers; note use of integer op `*`. (apply max (map (fn (prods) (apply * prods)) (remove '() (powerset lst))))) You'll need these functions. (define (mappend) (apply append (apply map (args)))) (define (powerset s) (if s (mappend (fn (x)...
- Thu May 30, 2019 6:08 pm
- Forum: newLISP in the real world
- Topic: Group the elements of a list
- Replies: 10
- Views: 6453
Re: Group the elements of a list
While I was exploring all the code, I believe that I found a bug. The following identity should hold: the reachability of the transitive closure of input is the same as the reachability of input . > (set-equal? (reachability input) (reachability (transD input))) nil Hmmm. What's going on? > (reachab...
- Thu May 30, 2019 5:42 pm
- Forum: newLISP in the real world
- Topic: Group the elements of a list
- Replies: 10
- Views: 6453
Re: Group the elements of a list
Then, how do you go the other way? I.e. how do you reduce into the smallest number of pairs, or at least find a sub list so that implied relationships are omitted from the list? Well, I perceive that you know the answer already, so I thank you for letting us share in the fun. :) Here is a function ...
- Wed May 29, 2019 11:29 pm
- Forum: newLISP in the real world
- Topic: Group the elements of a list
- Replies: 10
- Views: 6453
Re: Group the elements of a list
A recursive solution could be something like this: (define (trans s (x s) (f (and s (curry intersect (first s))))) (if s (trans (rest s) (cons (unique (flat (filter f x))) (clean f x))) x)) Perhaps there is something faster. Looks good, Ralph! I don't think I could do it faster. I prefer your code ...
- Tue May 28, 2019 7:02 pm
- Forum: newLISP in the real world
- Topic: Group the elements of a list
- Replies: 10
- Views: 6453
Re: Group the elements of a list
Right on, fdb! Lutz wins this round! :)
- Mon May 27, 2019 11:26 pm
- Forum: newLISP in the real world
- Topic: Nesting level of a list
- Replies: 5
- Views: 3991
Re: Nesting level of a list
Excellent, fdb! Faster than mine by about a factor of 3 (on the sample input)! 2.5 times faster than the original.
- Mon May 27, 2019 2:52 pm
- Forum: newLISP in the real world
- Topic: Nesting level of a list
- Replies: 5
- Views: 3991
Re: Nesting level of a list
Here's another way to do it. (define (nesting lst) (if (null? lst) 0 (atom? lst) 0 (+ 1 (apply max (map nesting lst))))) You be the judge if it's "better". Beware though that, although the code length is shorter, timing tests show that it is slightly *slower* than the original. map has to create mor...
- Mon May 13, 2019 12:18 pm
- Forum: newLISP and the O.S.
- Topic: Compile script to .exe with attached files
- Replies: 8
- Views: 9501
Re: Compile script to .exe with attached files
Hello, Just one question: Can't you combine your 3 lsp files into one? That would be the easiest way. Regards Good point, HPW. On another note, I am glad that Ralph posted his scripts which turn loads and file reads (“dynamic inclusion”) into “includes” (“static inclusion”), but only for the files ...
- Wed Apr 24, 2019 8:56 pm
- Forum: newLISP in the real world
- Topic: slice with negative "int-length"
- Replies: 5
- Views: 3947
Re: slice with negative "int-length"
Ah, I see what you did -- you put in the runtime checks on the bounds of the argument values. Very nice! I'd suggest commenting it a bit. I do this in my own code when I believe there is a chance that it will take me more than 5 seconds to re-parse and understand it when I return to read it in the f...
- Tue Apr 23, 2019 2:09 pm
- Forum: newLISP in the real world
- Topic: slice with negative "int-length"
- Replies: 5
- Views: 3947
Re: slice with negative "int-length"
We might want to add one more thing. Notice that we can omit the length argument in slice . > (slice '(0 1 2 3 4 5) 3) (3 4 5) > (slice '(0 1 2 3 4 5) -3) (3 4 5) But not so with our version of myslice (from the previous post). > (myslice '(0 1 2 3 4 5) 3) ERR: value expected in function + : len cal...
- Tue Apr 23, 2019 1:24 pm
- Forum: newLISP in the real world
- Topic: slice with negative "int-length"
- Replies: 5
- Views: 3947
Re: slice with negative "int-length"
Maybe it would have been better if the manual had said instead: "If int-length is negative, slice will take the parameter as offset counting from the end and copy up to but not including that offset." As far as the answer to your second question, I believe that all you need to do is transform the in...
- Sat Apr 20, 2019 8:16 pm
- Forum: newLISP in the real world
- Topic: libtls for TLS in newLISP
- Replies: 3
- Views: 3817
Re: libtls for TLS in newLISP
With a name like Kirill, surely you know that Easter (Pascha) is really next week. ;) Христос воскресе!Kirill wrote:Happy Easter!
- Thu Apr 11, 2019 1:16 am
- Forum: newLISP in the real world
- Topic: Are '(true nil) and '(true) is equal?
- Replies: 9
- Views: 7471
Re: Are '(true nil) and '(true) is equal?
Another way to exhibit the problem: > (= '(1 2 3 nil nil) '(1 2 3)) true > (= '(1 2 3 nil nil nil) '(1 2 3)) true > (= '(1 2 3 nil nil nil nil) '(1 2 3)) true > ;; and so on ... In nl-math.c, when the evaluation of any of the above expressions gets to `compareLists()` and `left` has the `nilSymbol`....
- Wed Apr 10, 2019 11:45 pm
- Forum: newLISP in the real world
- Topic: Are '(true nil) and '(true) is equal?
- Replies: 9
- Views: 7471
Re: Are '(true nil) and '(true) is equal?
Looks like a bug to me. At the very least, I believe that it should be a desirable property for the `=` operator to act as a symmetric relation, that is, that `(= a b)` and `(= b a)` return the same boolean value (for any `a` and `b`). More fundamentally, the manual says that for all the relational ...
- Sat Mar 30, 2019 6:01 pm
- Forum: newLISP newS
- Topic: Development release newLISP v.10.7.4
- Replies: 19
- Views: 19809
Re: Development release newLISP v.10.7.4
Thanks, Lutz! And thanks to Kirill for finding this!
- Sat Mar 30, 2019 2:50 am
- Forum: newLISP and the O.S.
- Topic: Newlisp-Apache-CGI Issues Again
- Replies: 29
- Views: 18061
Re: Newlisp-Apache-CGI Issues Again
Good catch, Ralph. I read that message wrong (but yet there is the response header name, right there between the two single quotes). Didn’t help that duke’s OP didn’t have the entire message there to begin with. Kinda faked me out. dukester! lol ;)
- Fri Mar 29, 2019 11:14 pm
- Forum: newLISP newS
- Topic: Development release newLISP v.10.7.4
- Replies: 19
- Views: 19809
Re: Development release newLISP v.10.7.4
Kirill, I get the same: $ uname -rsm FreeBSD 12.0-RELEASE amd64 $ fetch http://www.newlisp.org/downloads/development/SHA1.txt $ fetch http://www.newlisp.org/downloads/development/newlisp-10.7.4.tgz $ cat SHA1.txt; sha1 newlisp-10.7.4.tgz SHA1(newlisp-10.7.4.tgz)= 5a3ce129f43138773abdc479a03512699e8a...
- Fri Mar 29, 2019 11:09 pm
- Forum: newLISP and the O.S.
- Topic: Newlisp-Apache-CGI Issues Again
- Replies: 29
- Views: 18061
Re: Newlisp-Apache-CGI Issues Again
duke, I wasn't saying for Lutz to look at it, but for *you* to look at it. lol! No worries, I get it. I've been there many times. We do indeed have to make that determination: whether to spelunk or not. :) Sometimes, it's not worth it, especially when we have time constraints. I hope you get some ti...
- Fri Mar 29, 2019 7:21 pm
- Forum: newLISP and the O.S.
- Topic: Newlisp-Apache-CGI Issues Again
- Replies: 29
- Views: 18061
Re: Newlisp-Apache-CGI Issues Again
I keep wondering if it is not an Apache issue, but that question quickly fades away because I never get that response from any other interpreter! So it must be something that "print" or "println" is emitting? Maybe UTF8? That’s not what your hex dump indicates. It may be due to a configuration/inte...
- Wed Mar 27, 2019 5:34 pm
- Forum: newLISP and the O.S.
- Topic: Newlisp-Apache-CGI Issues Again
- Replies: 29
- Views: 18061
Re: Newlisp-Apache-CGI Issues Again
duke, Hex dump seems ok to me. I'm assuming you did something like: C:\> newlisp-cgi-script > newlisp-cgi.out Then, looked at newlisp-cgi.out in the hex editor. Maybe try also something like: C:\> perl-cgi-script > perl-cgi.out and maybe the same with the Ruby, CLISP scripts, etc. (i.e., all the CGI...
- Tue Mar 26, 2019 11:10 pm
- Forum: newLISP and the O.S.
- Topic: Newlisp-Apache-CGI Issues Again
- Replies: 29
- Views: 18061
Re: Newlisp-Apache-CGI Issues Again
What ralph said. Apache 2.4 got "strict" with the header validations to mitigate vulnerabilities when used as an http proxy, e.g. this one in 2016 (interesting read too): https://httpd.apache.org/security/vulnerabilities_24.html#CVE-2016-8743 Notice the switch where you can turn that off (although n...
- Tue Mar 26, 2019 6:56 pm
- Forum: newLISP and the O.S.
- Topic: Newlisp-Apache-CGI Issues Again
- Replies: 29
- Views: 18061
Re: Newlisp-Apache-CGI Issues Again
Looks suspiciously like the ole windoze versus unix line ending issue/difference. I’d check that before moving on to anything else.
For instance, what about trying this instead? (Sorry, “I don’t do windows.” :)
Or something like that? Good luck!
For instance, what about trying this instead? (Sorry, “I don’t do windows.” :)
Code: Select all
(println "Content-type: text/html")
(println "")