Search found 228 matches
- Wed Jul 16, 2014 10:39 am
- Forum: newLISP in the real world
- Topic: debugging newlisp scripts
- Replies: 0
- Views: 2672
debugging newlisp scripts
I'm fairly sure I'm not alone in having some one or two or even more than a few "teething problems" whenever I'm writing a new newlisp script. Or maybe I am, since I've been unable to find much to assist in this, and the built-in error messages are quite terse. In any case, I've augmented my public ...
- Sun Jul 06, 2014 3:41 pm
- Forum: Whither newLISP?
- Topic: newlisp to get mysql table command lead to messy code
- Replies: 7
- Views: 12608
Re: newlisp to get mysql table command lead to messy code
Maybe you can explain the problem a bit more in detail. I understood it to be that the strings in the COMMENT phrases look different in the newlisp printing than in your 'mysqlclient', which by extension might lead us to assume that the string values are different. My theory was that the string valu...
- Sun Jul 06, 2014 6:09 am
- Forum: Whither newLISP?
- Topic: newlisp to get mysql table command lead to messy code
- Replies: 7
- Views: 12608
Re: newlisp to get mysql table command lead to messy code
A quick glance into the source indicates that "println" is not very i18n friendly, though I don't have too much experience with it myself. Thus, my theory is that the string in newlisp is correct (i.e., the same as the other), but presented badly by println. Maybe a raw string output works better? (...
- Sat Jul 05, 2014 8:38 pm
- Forum: newLISP in the real world
- Topic: how to remove all attribute-list in diference level of SXML?
- Replies: 8
- Views: 5625
Re: how to remove all attribute-list in diference level of S
rickyboy's "deep-clean" is quite good. As a minimalist, I'd gone for a slightly more specialized solution; for example, if the SXML is regular, and in particular includes the attribute sub list for every node, i.e., even the empty ones, then I'd choose to simply traverse it, and remove the second of...
- Sat Jul 05, 2014 9:20 am
- Forum: newLISP in the real world
- Topic: how to remove all attribute-list in diference level of SXML?
- Replies: 8
- Views: 5625
Re: how to remove all attribute-list in diference level of S
Another, maybe simpler, way is:
Code: Select all
(find-all '(bananas *) data)
- Sat Jun 28, 2014 10:24 am
- Forum: newLISP in the real world
- Topic: newlisp -x and embedding data files
- Replies: 9
- Views: 5679
Re: newlisp -x and embedding data files
I already had this on my todo list since I also much prefer free standing executables for production code. So, just to complete the thought, I put together a small embedding module, which takes care of including loaded files into the embedding by means of replacing the standard load function. I've m...
- Sat Jun 28, 2014 3:17 am
- Forum: newLISP in the real world
- Topic: newlisp -x and embedding data files
- Replies: 9
- Views: 5679
Re: newlisp -x and embedding data files
Hmm; I'm sure you'd work it out, but as I tried it, I realized it requires a slightly more complex source clause, such as:
and this needs to be in the MAIN context.
Code: Select all
(write-file "myembedding.lsp"
(join (map source (filter (fn (s) (context? (eval s))) (symbols)))
""))
- Sat Jun 28, 2014 2:48 am
- Forum: newLISP in the real world
- Topic: Is it a FOOP peculiarity?
- Replies: 4
- Views: 3218
Re: Is it a FOOP peculiarity?
Maybe I should anwer my own question with: "Don't go there!". I think it ultimately is better for me to return to a proper relational data perspective rather than attemting a relational modeling of an object oriented data perspective. In that way I can avoid forcing a base level of platform inclusio...
- Sat Jun 28, 2014 1:20 am
- Forum: Anything else we might add?
- Topic: flat enough?
- Replies: 4
- Views: 6143
Re: flat enough?
Yes, I discovered that, and really it's probably not an issue, except perhaps for writing interospective analysis code, where you might end up spending an extra ten minutes or so wondering why certain code associations are missing. But then, you'll probably spend more time on figuring out why (first...
- Sat Jun 28, 2014 1:08 am
- Forum: newLISP in the real world
- Topic: newlisp -x and embedding data files
- Replies: 9
- Views: 5679
Re: newlisp -x and embedding data files
I don't think newlisp -x embeds other than the nominated module.
However, you may well use
which gets you a quite decent snapshot of the currently loaded state, in newlisp source.
Then just add the "run clauses", and embed that.
However, you may well use
Code: Select all
(write-file "myembedding.lsp" (source))
Then just add the "run clauses", and embed that.
- Fri Jun 27, 2014 12:42 am
- Forum: newLISP in the real world
- Topic: Is it a FOOP peculiarity?
- Replies: 4
- Views: 3218
Re: Is it a FOOP peculiarity?
Ok; that manual section is a little terse about how a punter like me should go about doing things whilst insisting on the idea of "changing fields in objects". I'm sure people have been here before, and I wonder if there's a "standard solution" somewhere? My first intuition is that this object conce...
- Thu Jun 26, 2014 2:44 pm
- Forum: newLISP in the real world
- Topic: Is it a FOOP peculiarity?
- Replies: 4
- Views: 3218
Re: Is it a FOOP peculiarity?
Ah! Right. Thanks. Interesting that I hadn't caught on to it eariler, but obviously I need to change my mind set a bit...
- Thu Jun 26, 2014 12:54 pm
- Forum: newLISP in the real world
- Topic: Is it a FOOP peculiarity?
- Replies: 4
- Views: 3218
Is it a FOOP peculiarity?
Now I ran into a wall trying to use FOOP, or possibly it's really a bug. Namely that it appears arguments get copied in some funny way.... I've isolated my problem to this small example code: (context 'One) (define (One:One v) (list (context) v)) (define (put v) (setf (self 1) v)) (context 'Two) (de...
- Mon Jun 23, 2014 5:26 am
- Forum: newLISP in the real world
- Topic: Getting keyboard "key events"
- Replies: 2
- Views: 2688
Re: Getting keyboard "key events"
Not sure how much effort it takes, but I'd check out using "curses".
Done before:
viewtopic.php?f=12&t=240&hilit=curses
Done before:
viewtopic.php?f=12&t=240&hilit=curses
- Sun Jun 22, 2014 11:32 am
- Forum: Anything else we might add?
- Topic: flat enough?
- Replies: 4
- Views: 6143
flat enough?
I just ran into this pebble on the beach, that the "flat" function doesn't flatten quoted sub lists. > (flat '('(1 2) (3 4))) ('(1 2) 3 4) Perhaps it's worth mentioning it in the doc, or fix it, if it's a mistake. By my inuition, the flat function should traverse into quoted lists the way it travers...
- Tue Jun 17, 2014 1:21 am
- Forum: newLISP in the real world
- Topic: make a function like lambda
- Replies: 2
- Views: 2532
Re: make a function like lambda
What about:
or, if you don't want its arguments to be evaluated:
Code: Select all
(define (extend-env:filter) (cons 'extend-env:filter (args))
Code: Select all
(define-macro (extend-env:filter) (cons 'extend-env:filter (args))
- Sun Jun 15, 2014 2:30 am
- Forum: newLISP in the real world
- Topic: I/O multiplexing on pipes
- Replies: 7
- Views: 5364
Re: I/O multiplexing on pipes
How about net-select? http://www.newlisp.org/downloads/newlisp_manual.html#net-select It's documented to deal with sockets, but at least on linux this means file descriptors in general (implemented at nl-sock.c#p_netSelect). (net-select (list fd1 fd2) "read" -1) This doesn't beat the pleasure of att...
- Sat Jun 14, 2014 1:31 pm
- Forum: newLISP newS
- Topic: Embed C or ASM in newLISP
- Replies: 7
- Views: 13018
Re: Embed C or ASM in newLISP
Right. My apologies.
- Sat Jun 14, 2014 11:34 am
- Forum: newLISP newS
- Topic: Embed C or ASM in newLISP
- Replies: 7
- Views: 13018
Re: Embed C or ASM in newLISP
You need to make it into "shared libraries", then run newlisp with LD_LIBRARY_PATH set up, then declare the imported functions with (import ...), then Bob's your uncle. It's amazingly simple (until you come to the data sharing) Maybe this is a help http://www.cprogramming.com/tutorial/shared-librari...
- Sat Jun 14, 2014 8:27 am
- Forum: newLISP in the real world
- Topic: C function callbacks
- Replies: 2
- Views: 2571
Re: C function callbacks
I might be in too deep surf here, but since noone else has ventured an answer yet, I'll give it a go... maybe it'll be of help to you. Notably, the "(address x)" function puts its argument into a CELL_LONG type cell, whose contents field holds the incoming value. Thus, if your C function gets that l...
- Sat Jun 07, 2014 2:21 pm
- Forum: newLISP in the real world
- Topic: Closing stdin for sub process
- Replies: 6
- Views: 7721
Re: Closing stdin for sub process
A little bit later, I realized I could wrap the "process" into a fork, and there close "myout" before spawning the sub process. Thusly wrapped: (fork (begin (close myout) (process ...))) It kind of validates my theory that "myout" indeed is open for the sub process. Perhaps it'd be sensible to revis...
- Sat Jun 07, 2014 1:46 pm
- Forum: newLISP in the real world
- Topic: Closing stdin for sub process
- Replies: 6
- Views: 7721
Closing stdin for sub process
I have difficulty in closing stdin for a sub process using (process ..). The code snippet is: ; Spawn a reader for emptying sub process stdout as my stdout (setq buffer nil) (map set '(myin subout) (pipe)) (fork (begin (close subout) (while (read myin buffer 1000) (print buffer)))) (close myin) (map...
- Sat Jun 07, 2014 4:16 am
- Forum: newLISP in the real world
- Topic: Setting stack and memory sizes in a script
- Replies: 1
- Views: 2003
Setting stack and memory sizes in a script
I just ran into the following quirk. Basically, I wanted to include stack and memory limits in a script and therefore thought I could do it in the script header line, as: !#/usr/bin/newlisp -s 4096 -m 100 but then I discovered that only the first of these options come into play. Eventually I learnt ...
- Sat Jun 07, 2014 2:22 am
- Forum: newLISP in the real world
- Topic: newLISP cells question
- Replies: 1
- Views: 2137
Re: newLISP cells question
As I understand it from having browsed the code, a list is represented in a succession of CELLs where the "contents" fields point to the list members. Thus, a list like (1 2) of two elements would be represented by 4 CELLs, two of which are list cells and two are integer cells. The Head (aka content...
- Sat Jun 07, 2014 1:39 am
- Forum: So, what can you actually DO with newLISP?
- Topic: Can I do cooperative multi-tasking?
- Replies: 2
- Views: 5336
Re: Can I do cooperative multi-tasking?
Great. Thanks. I suppose mostly it tells me that no sane person should venture into this even if they can make a good argument for having it :-)
Fair enough; and indeed, the newlisp as is, sure is a pleasure to work with anyhow.
Fair enough; and indeed, the newlisp as is, sure is a pleasure to work with anyhow.