Search found 7 matches
- Thu Jun 14, 2012 12:12 pm
- Forum: newLISP in the real world
- Topic: Catch form problem
- Replies: 2
- Views: 2948
Re: Catch form problem
Would you mind posting the solution just for the record in case somebody else finds this topic while looking for it?
- Mon Jun 11, 2012 2:16 pm
- Forum: newLISP in the real world
- Topic: int does not like 08 and 09?
- Replies: 5
- Views: 4584
Re: int does not like 08 and 09?
I learnt that the hard way - an old post http://newlisper.wordpress.com/2006/09/18/my-mistake-2/ describes my experience in tedious detail... To be fair I found it a bit weird when I first read about it as well. I think having h and o prefixes would have been clearer, but I guess as long as one kno...
- Mon Jun 11, 2012 4:38 am
- Forum: newLISP in the real world
- Topic: int does not like 08 and 09?
- Replies: 5
- Views: 4584
Re: int does not like 08 and 09?
See here in the documentation The string must begin with '0x' for hexadecimal strings or '0' (zero) for octal strings. If exp is invalid, int returns nil as a default value if not otherwise specified. If you prefix it with a 0, it will be evaluated as octal. There is no 9 or 8 in octal, since 8 dec ...
- Thu May 31, 2012 5:37 pm
- Forum: newLISP in the real world
- Topic: Printing string matrix
- Replies: 2
- Views: 2070
Re: Printing string matrix
My candidate: (define lst '("A" "B" "C")) (define (permuations lst i) (if (= i 1) ;; if i = 1, then just return the list lst ;; otherwise permutate the list with the permutations of i-1 (apply append (map (fn (x) (map (fn (y) (append x y)) lst)) (permuations lst (- i 1))) 2))) (println (permuations ...
- Thu May 31, 2012 7:53 am
- Forum: newLISP in the real world
- Topic: basic list understanding
- Replies: 4
- Views: 4093
Re: basic list understanding
From the manual it seems like you are using find-all wrong. If the input is a list, then you cannot use a regex, but must use a list-matching-pattern. If you want to match the elements in the list, then try filter or map. What I think you want to do can be done like this: (filter (fn (x) (find-all {...
- Tue May 29, 2012 8:54 am
- Forum: newLISP in the real world
- Topic: Getting higher frequency elements out of a list
- Replies: 3
- Views: 3098
Re: Getting higher frequency elements out of a list
I'm not 100% sure what you wanted, since your description and the example seem to contradict, so let me see: You want all duplicates in a list, sorted by how often they occur? ;; reverse inner list, so that only the value is an item again (println (map (fn (x) (first x)) ;; filter out those elements...
- Mon May 28, 2012 4:21 pm
- Forum: So, what can you actually DO with newLISP?
- Topic: Patrick Lerner's blog
- Replies: 1
- Views: 6364
Re: Patrick Lerner's blog
Ah oh, thanks for the publicity I guess :)