[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
newlispfanclub.alh.net • View topic - integer?

integer?

Q&A's, tips, howto's

integer?

Postby Sammo » Wed Dec 10, 2003 2:36 pm

Until now I've been running newLISP.DLL via NeoBook. This morning I installed from newlisp_7301_win-tk-104.exe.

1) Why does newLISP require the c:\temp directory (I'm running WIN2K) when there's a perfectly good temp directory elsewhere in the directory tree? I created c:\temp and newLISP runs fine now. Not a real problem -- just wondering.

2) I installed the non-DLL version of newLISP to test the integer? function. The following seems wrong:

> (map integer? '(1 2 1.1 sam 1sam sam1))
(true true nil nil true nil nil)

The seemingly wrong things are a) integer? is mapped to a list of six arguments but returns 7 results; b) the fifth result (integer? 1sam) returns true!

I wanted to test the integer? function because I noticed that I could call my Roman Numeral converter with (roman 1sam) and it would return "I". The opening test in my program is:

(if (and (integer? n) (> n 0)) ...

Not only did (integer? 1sam) return true, the subsequent code treated "1sam" as an integer of value 1.
Sammo
 
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Postby HPW » Wed Dec 10, 2003 3:13 pm

Sam,

It's a feature!

Take a look at this thread:

http://www.alh.net/newlisp/phpbb/viewtopic.php?t=126
HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

curiouser

Postby Sammo » Wed Dec 10, 2003 3:43 pm

;list of three -> four results (notice the malformed "1sam")
> (map integer? '(1 1 1sam))
(true true true nil)

;list of three -> three results
> (map integer? '(1 1 sam))
(true true nil)

I'm guessing that (integer? 1sam) uses as much of the argument "1sam" as it can to make an integer and leaves the rest for the lisp reader to deal with. The lisp reader sees more characters -- "sam" and so constructs another atom or symbol from them. I could maybe accept that treating 1sam as an integer is a feature, but treating 1sam as two distinct entities is not a feature -- it is a bug!
Sammo
 
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Postby Lutz » Wed Dec 10, 2003 4:29 pm

Hi Sam, first to the c:\temp issue. newLISP-tk needs a temp directory for temporary files. As a default c:\temp is configured. You can change this by editing the 'newlisp-tk.config' file.

To the "1sam" issue. One could change the parse to flag this as an parse error, which I do not want fo reasons outlined below. At this moment if you do:

(parse "1sam") => (1 "sam")

The advantage is that you are able to feed any non-LISP text to the parser wihout causing errors (after translating quotes). When doing natuarl language processing work, it is attractive to work at words as symbols directly, instead of using words as string tokens. This makes especially sence in newLISP, where the symbol implementation is very efficient and scaleable to millions (if you have the memory ;)) of symbols. Looking at "1sam" as two tokens makes sense, if you think of natural language constructs, such as 1kg 1Mbyte 1000$, etc.

I hope that this way to parse code in newLISP is not too big of a drawback for you when using newLISP.

If you have doubts on how the parser works, it is exposed via the function 'parse' which works exactly like newLISPs internal parser (when no break string is specified).

You can cusotmize 'parse' with an addtional break string argument (can be a regular expression), but that would not change the behaviour of parsing newLISP source.

Lutz
Last edited by Lutz on Wed Dec 10, 2003 5:54 pm, edited 1 time in total.
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby Lutz » Wed Dec 10, 2003 4:32 pm

there have been several changes in the parser during the 7.3.xx series, so make sure you get the latest version of newLISP from the development drectory.

Lutz
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 0 guests

cron