Search found 13 matches
- Wed Mar 17, 2010 7:26 am
- Forum: newLISP newS
- Topic: newLISP stable release 10.2.0
- Replies: 4
- Views: 4259
Re: newLISP stable release 10.2.0
Thanks Lutz and the community for all your contribution to newLISP! After trying the new version, I've found some bugs??: 1. `setf` redefines `nil` if the place argument is a non-existing `assoc`: (setf (assoc 'a '()) '(a 1)) nil # => (a 1) By the way, is it possible to implicitly add an assoc if it...
- Sat Feb 06, 2010 12:58 pm
- Forum: newLISP in the real world
- Topic: Request: Function to give context given symbol
- Replies: 41
- Views: 18951
Re: Request: Function to give context given symbol
I like itistoday's `sym-context`. What if "warning" is used instead of "error" when name clashes (redefining protected names)? Old code can be run without changes, because it didn't mean to use the "new" definition of the names. By the way, I use a naming convention that starts "variables" with an u...
- Fri Jan 22, 2010 8:08 pm
- Forum: Anything else we might add?
- Topic: Wish list
- Replies: 33
- Views: 19066
Re: Wish list
Or, like `lookup`, adding a parameter to `nth` for a "default value" to return in case an index is out of bounds:
But Kazimir's suggestion is more general, in case we don't know a value that would never exist in the list.
Code: Select all
(nth 5 '(1 2 3) 0) # => 0
- Wed Jan 20, 2010 8:33 pm
- Forum: Anything else we might add?
- Topic: Wish list
- Replies: 33
- Views: 19066
Re: Wish list
Thanks Lutz for clarifications
- Wed Jan 20, 2010 11:20 am
- Forum: Anything else we might add?
- Topic: Wish list
- Replies: 33
- Views: 19066
Re: Wish list
As for new FOOP, is `self` a function or a list? And how can I use association list for fields? In old FOOP, I can do: (define (C:C x y) (list C (list 'x x) (list 'y y))) (define (C:p o) (println "x=" (lookup 'x o) "; y=" (lookup 'y o))) (:p (C 1 2)) # x=1; y=2 By the way, is it a good idea if newLI...
- Sun Jan 17, 2010 7:05 pm
- Forum: Anything else we might add?
- Topic: Wish list
- Replies: 33
- Views: 19066
Re: Wish list
Thanks a lot, Lutz! Curious about which wishes will come true ;-) Kazimir, I like your floating-point operators (+., *., etc), first found it in your library, and hope they will be built-in too, so they will be standard names. Currently I do: (setq +. add -. sub *. mul /. div %. mod) As for, `modify...
- Sun Jan 17, 2010 9:20 am
- Forum: Anything else we might add?
- Topic: Wish list
- Replies: 33
- Views: 19066
Re: Wish list
Lutz, Yes `slice` works, but in this case it will unnecessary allocate memory, right? It's not good if (find p (i s)) is used in a loop, when s is very large. TedWalther, comment macro does not work. (define-macro (comment)) (list 1 (comment 2) 3) # => (1 nil 3), not (1 3) xytroxon, In my opinion, I...
- Sat Jan 16, 2010 5:07 pm
- Forum: newLISP in the real world
- Topic: Parsing another lisp-ish language
- Replies: 5
- Views: 2771
Re: Parsing another lisp-ish language
Try this ... (local (h codelen code separator elider) # add `h` (head of current list) ... (when (= i 0) (setq h code # set `h` here res (append res "<@ " (string code) ">" ))) ... (setq elider (find (upper-case (string h)) '("OMT" "SAO" "OSA" "SAI" "OSI" "SAW" "OSW"))) # change `code` to `h` ... He...
- Sat Jan 16, 2010 4:28 pm
- Forum: Anything else we might add?
- Topic: Wish list
- Replies: 33
- Views: 19066
Re: Wish list
Thank cormullion for your feedback. As for block comment, a string cannot be used as an alternative for a comment in all places. For example, to "comment-out" an item (2) in a list, compare: (list 1 "2" 3) # use string, not valid (list 1 # 2 # use single-line comment, ok but need to reformat code 3 ...
- Fri Jan 15, 2010 9:40 pm
- Forum: Anything else we might add?
- Topic: Wish list
- Replies: 33
- Views: 19066
Wish list
Hi! After learning newLISP for some times, here is my wish list ;-) 1. block/multi-line (nestable) comment; its syntax might be #{...}# 2. .0 is not removed when printing floats (e.g. 1.0 should be printed 1.0, not 1) 3. regex-option parameters should accept nil to mean not using regular expression ...
- Fri Jan 01, 2010 12:40 am
- Forum: newLISP in the real world
- Topic: Duplicates in list...
- Replies: 8
- Views: 3402
Re: Duplicates in list...
A "imperative" solution: (let (R '() L l E nil) (while L (setq E (pop L)) (when (or (find E R) (find E L)) (push E R -1) )) R ) or in one line ;-) (let (R '() L l E nil) (while L (setq E (pop L)) (when (or (find E R) (find E L)) (push E R -1))) R) But I love Kazimir's solution. Thanks. Happy New Yea...
- Sat Dec 26, 2009 12:49 pm
- Forum: newLISP in the real world
- Topic: Returning by reference
- Replies: 3
- Views: 2175
Re: Returning by reference
By the way, in the following code: (setq x ((fn () '(a b c)))) # => (a b c) does it perform ONE (either when returning or binding) or TWO (both) copy operations? Is it possible to make all sequences return "by reference"? I think this still conforms to ORO (One Reference Only) memory management, as ...
- Sat Dec 26, 2009 12:36 am
- Forum: newLISP in the real world
- Topic: Returning by reference
- Replies: 3
- Views: 2175
Returning by reference
Hi, How to "return by reference" from a user-defined function/macro? (let (l '(a b c)) (pop l) l) # => (b c) (let (l '(a b c)) (pop (or l)) l) # => (b c) (let (l '(a b c)) (pop (println l)) l) # => (a b c); is this a bug? (let (l '(a b c)) (pop (begin (println l) l)) l) # => (b c) (let (l '(a b c)) ...