Search found 608 matches
- Sat Dec 05, 2015 12:07 pm
- Forum: newLISP in the real world
- Topic: Closing stdin for sub process
- Replies: 6
- Views: 7817
Re: Closing stdin for sub process
I think I'm having the same problem. Here is the code: (define (remote-script remconnect remscript) (map set '(inloc outrem) (pipe)) (map set '(inrem outloc) (pipe)) (set 'pid (process remconnect inrem outrem)) (write outloc remscript) (close outloc) (close inrem) (close outrem) (while (set 'p (peek...
- Sun Nov 29, 2015 11:46 pm
- Forum: newLISP and the O.S.
- Topic: unix.lsp / unix:syslog, example please
- Replies: 5
- Views: 7165
Re: unix.lsp / unix:syslog, example please
Thanks Darth.
- Wed Nov 25, 2015 9:04 pm
- Forum: newLISP and the O.S.
- Topic: unix.lsp / unix:syslog, example please
- Replies: 5
- Views: 7165
Re: unix.lsp / unix:syslog, example please
Which version of Linux?
- Mon Nov 09, 2015 6:58 pm
- Forum: newLISP newS
- Topic: Book about Fuzzy Logic in newLISP
- Replies: 9
- Views: 15370
Re: Book about Fuzzy Logic in newLISP
Wow, awesome! I'm buying a copy of the book right now. There are a couple projects that could use proportionate control, fuzzy logic will be perfect.
- Mon Nov 02, 2015 7:23 pm
- Forum: newLISP in the real world
- Topic: ANNOUNCE: wb, an Aviation Weight/Balance Calculator
- Replies: 4
- Views: 9639
- Tue Sep 08, 2015 6:30 pm
- Forum: newLISP in the real world
- Topic: "save" makes improper [text] strings; impossible to reload
- Replies: 26
- Views: 18665
Re: "save" makes improper [text] strings; impossible to relo
Thank you Lutz. I woke up from a dream this morning with another solution, but then saw you had implemented this one. I'm very glad and appreciate the one you implemented. Here was the one I saw in the dream: (length str_one) => 5000 str_one => [text 5000].....[/text] Also, funny enough, I came acro...
- Mon Sep 07, 2015 1:00 am
- Forum: newLISP in the real world
- Topic: "save" makes improper [text] strings; impossible to reload
- Replies: 26
- Views: 18665
Re: "save" makes improper [text] strings; impossible to relo
The base64 solution bothers me, because it breaks the human readability of the (save) output. Can you share a bit more info about the speedups you achieved with the three different string types? How about a 4th type of string, L" for "" strings longer than 2048 bytes? update Or instead of L"my strin...
- Fri Sep 04, 2015 11:04 pm
- Forum: newLISP in the real world
- Topic: "save" makes improper [text] strings; impossible to reload
- Replies: 26
- Views: 18665
Re: "save" makes improper [text] strings; impossible to relo
I was thinking, from point of view of correctness, easiest just to have "" for strings. Go language has `` for unescaped strings. {} strings are convenient, but can sometimes bite that they can only contain balanced parenthesis. I think overall, if "" worked for any size, I'd rarely use the other ki...
- Tue Aug 25, 2015 9:26 pm
- Forum: newLISP in the real world
- Topic: Strange problem with dolist
- Replies: 13
- Views: 10008
Re: Strange problem with dolist
Never mind, it is simple enough, here is my script, it helps with debugging unicode issues. #!/usr/bin/newlisp (load "unicode-names.lsp") (define histogram:histogram) (define (hex n) (push "0x" (upper-case (format "%x" n)))) (while (setq c (read-utf8 0)) (setq c (char c)) (if (histogram c) (++ (hist...
- Tue Aug 25, 2015 9:08 pm
- Forum: newLISP in the real world
- Topic: Strange problem with dolist
- Replies: 13
- Views: 10008
Re: Strange problem with dolist
Yeah. I find in general, newLISP doesn't put any burden on you that it doesn't have to. When dealing with Unicode, there are lots of characters that don't show up when you print. Even with regular ASCII, there are codes like "\0" that don't show up at all. If you don't know where your data is coming...
- Tue Aug 25, 2015 7:03 pm
- Forum: newLISP in the real world
- Topic: Strange problem with dolist
- Replies: 13
- Views: 10008
Re: Strange problem with dolist
I think programs are not supposed to read the BOM when reading a file (this way). When I do $> cat file in Linux, then the BOM is not shown, nor in any other program. How I've shown above in newLisp it's even a difference when using println or using starts-with. This makes no sense at all, people m...
- Tue Aug 25, 2015 4:46 pm
- Forum: newLISP in the real world
- Topic: Strange problem with dolist
- Replies: 13
- Views: 10008
Re: Strange problem with dolist
Wierd. I think BOM is supposed to only happen once, at the very beginning of the file. Right, and that fits exactly to the error I got. Only the first line makes troubles. Oh! I read your post as saying the opposite; I thought the first line worked, and the others didn't. In that case, the fix is e...
- Mon Aug 24, 2015 4:58 pm
- Forum: newLISP in the real world
- Topic: Strange problem with dolist
- Replies: 13
- Views: 10008
Re: Strange problem with dolist
Ok, try this code with the BOM enabled:
Code: Select all
(dolist (temp result-list)
(println (char (first temp)) {(} (first temp) {) } temp))
- Mon Aug 24, 2015 4:54 pm
- Forum: newLISP in the real world
- Topic: Strange problem with dolist
- Replies: 13
- Views: 10008
Re: Strange problem with dolist
Wierd. I think BOM is supposed to only happen once, at the very beginning of the file. About the error: my eyesight. Didn't see that the -1 was detached from the variable name. I THOUGHT it was a wierd variable name... :) So even in the (cond ...) style, the code doesn't work if BOM is in the file?
- Sun Aug 23, 2015 6:14 pm
- Forum: newLISP in the real world
- Topic: Strange problem with dolist
- Replies: 13
- Views: 10008
Re: Strange problem with dolist
(dolist (temp input-list) (when (not (or (starts-with temp "#") (starts-with temp "\t"))) (replace " " temp " ") (extend temp "<br>") (push temp result-list -1)) (when (starts-with temp "#") (push (heading temp) result-list -1))) Here, cleaned it up a little for you. Here is a question: are yo...
- Fri Aug 21, 2015 7:35 pm
- Forum: newLISP in the real world
- Topic: "save" makes improper [text] strings; impossible to reload
- Replies: 26
- Views: 18665
Re: "save" makes improper [text] strings; impossible to relo
Lutz, can you change things so that "save" function works? Is save much good if you can't "load" the output?
- Thu Aug 20, 2015 1:05 am
- Forum: newLISP in the real world
- Topic: "save" makes improper [text] strings; impossible to reload
- Replies: 26
- Views: 18665
Re: "save" makes improper [text] strings; impossible to relo
As a temporary workaround, before I ever "save" a string, I do (replace {]} my_string {\]}). And then after saving and loading it, I reverse it with (replace {\]} my_string {]})
- Thu Aug 20, 2015 12:29 am
- Forum: newLISP in the real world
- Topic: "save" makes improper [text] strings; impossible to reload
- Replies: 26
- Views: 18665
"save" makes improper [text] strings; impossible to reload
I stored some text in a context. That text contained a lot of cut and pasted newlisp code. I did (save "myfile.lsp" MySnippets) It saved it all. Then I do (load "myfile.lsp") Uh-oh. Error. ERR: symbol expected : [text] blahblahblah There is no line number, and it is a big file. grep doesn't work. Po...
- Fri Aug 14, 2015 1:30 am
- Forum: Anything else we might add?
- Topic: add function defined?
- Replies: 4
- Views: 7187
Re: add function defined?
Wonder if that would work as (define-macro (defined? a) ...)
- Sun Aug 09, 2015 11:04 pm
- Forum: newLISP newS
- Topic: UTF8 and regular expressions in newLISP
- Replies: 7
- Views: 12279
Re: UTF8 and regular expressions in newLISP
E.g., > (setf b (pack "b" (+ 0xc0 0x30))) "�" > (regex "x" (b -1)) ERR: invalid UTF8 string in function regex This is why it is hard to chase down; the interactions between utf8 mode and octet (raw byte) mode. > (b -1) ERR: invalid UTF8 string > b "�" > (char b) 2827 > (bits b) ERR: value expected ...
- Sun Aug 09, 2015 10:47 pm
- Forum: newLISP newS
- Topic: UTF8 and regular expressions in newLISP
- Replies: 7
- Views: 12279
Re: UTF8 and regular expressions in newLISP
I guess the confusion is that the difference between character streams and byte streams isn't always obvious. Both are useful.
- Sun Aug 09, 2015 10:44 pm
- Forum: newLISP in the real world
- Topic: impliciting indexing doesn't cross list/string boundaries
- Replies: 1
- Views: 3705
Re: impliciting indexing doesn't cross list/string boundarie
This one did work: (first (foo 0))
- Sun Aug 09, 2015 10:16 pm
- Forum: newLISP in the real world
- Topic: impliciting indexing doesn't cross list/string boundaries
- Replies: 1
- Views: 3705
impliciting indexing doesn't cross list/string boundaries
I have this: (set 'foo '("#foo" "bar" "baz" "some text")) I expected this to work: (foo 0 0) => "#" Instead it returned "#foo". A bit surprising. I know that (foo 0) works as a list index; is newlisp supposed to ignore bogus indexes afterward? Either newlisp should cross the list/string boundary and...
- Sun Aug 09, 2015 9:10 pm
- Forum: newLISP in the real world
- Topic: case different from cond; doesn't allow "default"
- Replies: 1
- Views: 3682
case different from cond; doesn't allow "default"
Lately, when I've been using cond, I make use of a trick for cond: (cond ((= a b) foo) (default bar)) This works, because "default" is a builtin function with an address, so it always evaluates to true. I was actually shocked that there is a builtin function named "default". Had to look it up to see...
- Sun Aug 09, 2015 6:54 pm
- Forum: newLISP newS
- Topic: UTF8 and regular expressions in newLISP
- Replies: 7
- Views: 12279
Re: UTF8 and regular expressions in newLISP
PEG looks neat. Have you tried this implementation? Does it work?
Update
Reading the Wiki page, I didn't realize that PEG is a formalism for recursive descent parsers. Awesome!